private FindIndexName ( DocumentDatabase database, |
||
database | DocumentDatabase | |
map | ||
query | ||
return | void |
public static DynamicQueryMapping Create(DocumentDatabase database, IndexQuery query, string entityName) { var fields = SimpleQueryParser.GetFieldsForDynamicQuery(query.Query); if (query.SortedFields != null) { foreach (var sortedField in query.SortedFields) { if (sortedField.Field.StartsWith(Constants.RandomFieldName)) { continue; } fields.Add(Tuple.Create(sortedField.Field, sortedField.Field)); } } var dynamicQueryMapping = new DynamicQueryMapping { AggregationOperation = query.AggregationOperation.RemoveOptionals(), DynamicAggregation = query.AggregationOperation.HasFlag(AggregationOperation.Dynamic), ForEntityName = entityName, SortDescriptors = GetSortInfo(fieldName => { if (fields.Any(x => x.Item2 == fieldName || x.Item2 == (fieldName + "_Range")) == false) { fields.Add(Tuple.Create(fieldName, fieldName)); } }) }; dynamicQueryMapping.SetupFieldsToIndex(query, fields); dynamicQueryMapping.FindIndexName(database, dynamicQueryMapping, query); return(dynamicQueryMapping); }
public static DynamicQueryMapping Create(DocumentDatabase database, IndexQuery query, string entityName) { var fields = SimpleQueryParser.GetFieldsForDynamicQuery(query); if (query.SortedFields != null) { foreach (var sortedField in query.SortedFields) { var field = sortedField.Field; if (field.StartsWith(Constants.RandomFieldName)) { continue; } if (field.StartsWith(Constants.CustomSortFieldName)) { continue; } if (field == Constants.TemporaryScoreValue) { continue; } if (field.EndsWith("_Range")) { field = field.Substring(0, field.Length - "_Range".Length); } fields.Add(Tuple.Create(SimpleQueryParser.TranslateField(field), field)); } } var dynamicQueryMapping = new DynamicQueryMapping { ForEntityName = entityName, HighlightedFields = query.HighlightedFields.EmptyIfNull().Select(x => x.Field).ToArray(), SortDescriptors = GetSortInfo(fieldName => { if (fields.Any(x => x.Item2 == fieldName || x.Item2 == (fieldName + "_Range")) == false) { fields.Add(Tuple.Create(fieldName, fieldName)); } }, query) }; dynamicQueryMapping.SetupFieldsToIndex(query, fields); dynamicQueryMapping.SetupSortDescriptors(dynamicQueryMapping.SortDescriptors); dynamicQueryMapping.FindIndexName(database, dynamicQueryMapping, query); return(dynamicQueryMapping); }
public static DynamicQueryMapping Create(DocumentDatabase database, IndexQuery query, string entityName) { var fields = SimpleQueryParser.GetFieldsForDynamicQuery(query.Query); if (query.SortedFields != null) { foreach (var sortedField in query.SortedFields) { fields.Add(Tuple.Create(sortedField.Field, sortedField.Field)); } } var dynamicQueryMapping = new DynamicQueryMapping { AggregationOperation = query.AggregationOperation & ~AggregationOperation.Dynamic, DynamicAggregation = (query.AggregationOperation & AggregationOperation.Dynamic) == AggregationOperation.Dynamic, ForEntityName = entityName, SortDescriptors = GetSortInfo(fields) }; dynamicQueryMapping.SetupFieldsToIndex(query, fields); dynamicQueryMapping.FindIndexName(database, dynamicQueryMapping, query); return(dynamicQueryMapping); }
public static DynamicQueryMapping Create(DocumentDatabase database, IndexQuery query, string entityName) { var fields = SimpleQueryParser.GetFieldsForDynamicQuery(query); if (query.SortedFields != null) { foreach (var sortedField in query.SortedFields) { var field = sortedField.Field; if (field.StartsWith(Constants.RandomFieldName)) continue; if (field == Constants.TemporaryScoreValue) continue; if (field.EndsWith("_Range")) field = field.Substring(0, field.Length - "_Range".Length); fields.Add(Tuple.Create(SimpleQueryParser.TranslateField(field), field)); } } var dynamicQueryMapping = new DynamicQueryMapping { ForEntityName = entityName, HighlightedFields = query.HighlightedFields.EmptyIfNull().Select(x => x.Field).ToArray(), SortDescriptors = GetSortInfo(fieldName => { if (fields.Any(x => x.Item2 == fieldName || x.Item2 == (fieldName + "_Range")) == false) fields.Add(Tuple.Create(fieldName, fieldName)); }, query) }; dynamicQueryMapping.SetupFieldsToIndex(query, fields); dynamicQueryMapping.SetupSortDescriptors(dynamicQueryMapping.SortDescriptors); dynamicQueryMapping.FindIndexName(database, dynamicQueryMapping, query); return dynamicQueryMapping; }
public static DynamicQueryMapping Create(DocumentDatabase database, IndexQuery query, string entityName) { var fields = SimpleQueryParser.GetFieldsForDynamicQuery(query); if (query.SortedFields != null) { foreach (var sortedField in query.SortedFields) { if (sortedField.Field.StartsWith(Constants.RandomFieldName)) continue; if (sortedField.Field == Constants.TemporaryScoreValue) continue; fields.Add(Tuple.Create(sortedField.Field, sortedField.Field)); } } var dynamicQueryMapping = new DynamicQueryMapping { AggregationOperation = query.AggregationOperation.RemoveOptionals(), DynamicAggregation = query.AggregationOperation.HasFlag(AggregationOperation.Dynamic), ForEntityName = entityName, HighlightedFields = query.HighlightedFields.EmptyIfNull().Select(x=>x.Field).ToArray(), SortDescriptors = GetSortInfo(fieldName => { if (fields.Any(x => x.Item2 == fieldName || x.Item2 == (fieldName + "_Range")) == false) fields.Add(Tuple.Create(fieldName, fieldName)); }) }; dynamicQueryMapping.SetupFieldsToIndex(query, fields); dynamicQueryMapping.SetupSortDescriptors(dynamicQueryMapping.SortDescriptors); dynamicQueryMapping.FindIndexName(database, dynamicQueryMapping, query); return dynamicQueryMapping; }
public static DynamicQueryMapping Create(DocumentDatabase database, IndexQuery query, string entityName) { var fields = SimpleQueryParser.GetFieldsForDynamicQuery(query.Query); if(query.SortedFields != null) { foreach (var sortedField in query.SortedFields) { fields.Add(Tuple.Create(sortedField.Field, sortedField.Field)); } } var dynamicQueryMapping = new DynamicQueryMapping { AggregationOperation = query.AggregationOperation.RemoveOptionals(), DynamicAggregation = query.AggregationOperation.HasFlag(AggregationOperation.Dynamic), ForEntityName = entityName, SortDescriptors = GetSortInfo(fieldName => { if (fields.Any(x => x.Item2 == fieldName || x.Item2 == (fieldName + "_Range")) == false) fields.Add(Tuple.Create(fieldName, fieldName)); }) }; dynamicQueryMapping.SetupFieldsToIndex(query, fields); dynamicQueryMapping.FindIndexName(database, dynamicQueryMapping, query); return dynamicQueryMapping; }
public static DynamicQueryMapping Create(DocumentDatabase database, IndexQuery query, string entityName) { var fields = SimpleQueryParser.GetFieldsForDynamicQuery(query.Query); if(query.SortedFields != null) { foreach (var sortedField in query.SortedFields) { fields.Add(Tuple.Create(sortedField.Field, sortedField.Field)); } } var dynamicQueryMapping = new DynamicQueryMapping { AggregationOperation = query.AggregationOperation & ~AggregationOperation.Dynamic, DynamicAggregation = (query.AggregationOperation & AggregationOperation.Dynamic) == AggregationOperation.Dynamic, ForEntityName = entityName, SortDescriptors = GetSortInfo(fields) }; dynamicQueryMapping.SetupFieldsToIndex(query, fields); dynamicQueryMapping.FindIndexName(database, dynamicQueryMapping, query); return dynamicQueryMapping; }