FindIndexName() 개인적인 메소드

private FindIndexName ( DocumentDatabase database, DynamicQueryMapping map, IndexQuery query ) : void
database DocumentDatabase
map DynamicQueryMapping
query IndexQuery
리턴 void
예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
		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;
		}
예제 #5
0
		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;
		}
예제 #6
0
		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;
		}
예제 #7
0
		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;
		}