Ejemplo n.º 1
0
        public static IndexQuery GetIndexQueryFromHttpContext(this IHttpContext context, int maxPageSize)
        {
            var query = new IndexQuery
            {
                Query = context.Request.QueryString["query"] ?? "",
                Start = context.GetStart(),
                Cutoff = context.GetCutOff(),
                PageSize = context.GetPageSize(maxPageSize),
                SkipTransformResults = context.GetSkipTransformResults(),
                FieldsToFetch = context.Request.QueryString.GetValues("fetch"),
				GroupBy = context.Request.QueryString.GetValues("groupBy"),
				AggregationOperation = context.GetAggregationOperation(),
                SortedFields = context.Request.QueryString.GetValues("sort")
                    .EmptyIfNull()
                    .Select(x => new SortedField(x))
                    .ToArray()
            };

            double lat = context.GetLat(), lng = context.GetLng(), radius = context.GetRadius();
            if (lat != 0 || lng != 0 || radius != 0)
            {
                return new SpatialIndexQuery(query)
                {
                    Latitude = lat,
                    Longitude = lng,
                    Radius = radius,
                };
            }
            return query;
        }
Ejemplo n.º 2
0
		public static string FindDynamicIndexName(this DocumentDatabase self, string entityName, IndexQuery query)
		{
            var result = new DynamicQueryOptimizer(self).SelectAppropriateIndex(entityName, query.Clone());
		    if (result.MatchType == DynamicQueryMatchType.Complete)
		        return result.IndexName;
		    return null;
		}
Ejemplo n.º 3
0
		private QueryResult ExecuteActualQuery(IndexQuery query, DynamicQueryMapping map, Tuple<string, bool> touchTemporaryIndexResult, string realQuery)
		{
			// Perform the query until we have some results at least
			QueryResult result;
			var sp = Stopwatch.StartNew();
			while (true)
			{
				result = documentDatabase.Query(map.IndexName,
				                                new IndexQuery
				                                {
				                                	Cutoff = query.Cutoff,
				                                	PageSize = query.PageSize,
				                                	Query = realQuery,
				                                	Start = query.Start,
				                                	FieldsToFetch = query.FieldsToFetch,
				                                	GroupBy = query.GroupBy,
				                                	AggregationOperation = query.AggregationOperation,
				                                	SortedFields = query.SortedFields,
				                                });

				if (!touchTemporaryIndexResult.Item2 ||
				    !result.IsStale ||
				    result.Results.Count >= query.PageSize ||
				    sp.Elapsed.TotalSeconds > 15)
				{
					return result;
				}

				Thread.Sleep(100);
			}
		}
Ejemplo n.º 4
0
        public QueryResultWithIncludes Query(string index, IndexQuery query, CancellationToken externalCancellationToken)
        {
            QueryResultWithIncludes result = null;
            using (var cts = CancellationTokenSource.CreateLinkedTokenSource(externalCancellationToken, WorkContext.CancellationToken))
            {
                var cancellationToken = cts.Token;

                TransactionalStorage.Batch(
                    accessor =>
                    {
                        using (var op = new DatabaseQueryOperation(Database, index, query, accessor, cancellationToken)
                        {
                            ShouldSkipDuplicateChecking = query.SkipDuplicateChecking
                        })
                        {
                            var list = new List<RavenJObject>();
                            op.Init();
                            op.Execute(list.Add);
                            op.Result.Results = list;
                            result = op.Result;
                        }
                    });
            }

            return result;
        }
Ejemplo n.º 5
0
		public static List<DynamicQueryOptimizer.Explanation> ExplainDynamicIndexSelection(this DocumentDatabase self, string entityName, IndexQuery query)
		{
			var explanations = new List<DynamicQueryOptimizer.Explanation>();
			new DynamicQueryOptimizer(self)
				.SelectAppropriateIndex(entityName, query.Clone(), explanations);
			return explanations;
		}
Ejemplo n.º 6
0
 public ExecutingQueryInfo(DateTime startTime, IndexQuery queryInfo, long queryId, CancellationTokenSource tokenSource)
 {
     StartTime = startTime;
     QueryInfo = queryInfo;
     QueryId = queryId;
     stopwatch = Stopwatch.StartNew();
     TokenSource = tokenSource;
 }
Ejemplo n.º 7
0
		public RavenJArray DeleteByIndex(string indexName, IndexQuery queryToDelete, bool allowStale)
		{
			return PerformBulkOperation(indexName, queryToDelete, allowStale, (docId, tx) =>
			{
				database.Delete(docId, null, tx);
				return new { Document = docId, Deleted = true };
			});
		}
Ejemplo n.º 8
0
		public RavenJArray UpdateByIndex(string indexName, IndexQuery queryToUpdate, PatchRequest[] patchRequests, bool allowStale)
		{
			return PerformBulkOperation(indexName, queryToUpdate, allowStale, (docId, tx) =>
			{
				var patchResult = database.ApplyPatch(docId, null, patchRequests, tx);
				return new { Document = docId, Result = patchResult };
			});
		}
        public RavenJArray DeleteByIndex(string indexName, IndexQuery queryToDelete, BulkOperationOptions options = null)
        {
            return PerformBulkOperation(indexName, queryToDelete, options, (docId, tx) =>
			{
				database.Documents.Delete(docId, null, tx);
				return new { Document = docId, Deleted = true };
			});
		}
        public RavenJArray UpdateByIndex(string indexName, IndexQuery queryToUpdate, ScriptedPatchRequest patch, BulkOperationOptions options = null)
		{
            return PerformBulkOperation(indexName, queryToUpdate, options, (docId, tx) =>
			{
				var patchResult = database.Patches.ApplyPatch(docId, null, patch, tx);
				return new { Document = docId, Result = patchResult.Item1, Debug = patchResult.Item2 };
			});
		}
Ejemplo n.º 11
0
        // GET: Campaign
        public async Task<IActionResult> Index()
        {
            var query = new IndexQuery();
            if (User.IsUserType(UserType.OrgAdmin))
            {
                query.OrganizationId = User.GetOrganizationId();
            }

            return View(await _mediator.SendAsync(query));
        }
Ejemplo n.º 12
0
		private static void UpdateFieldNamesForSortedFields(IndexQuery query, DynamicQueryMapping map)
		{
			if (query.SortedFields == null) return;
			foreach (var sortedField in query.SortedFields)
			{
				var item = map.Items.FirstOrDefault(x => x.From == sortedField.Field);
				if (item != null)
					sortedField.Field = item.To;
			}
		}
Ejemplo n.º 13
0
        private static IndexQuery CreateIndexQuery(IndexQuery query, DynamicQueryMapping map, string realQuery)
        {
            var indexQuery = new IndexQuery
            {
                Cutoff = query.Cutoff,
                WaitForNonStaleResultsAsOfNow = query.WaitForNonStaleResultsAsOfNow,
                PageSize = query.PageSize,
                Query = realQuery,
                Start = query.Start,
                FieldsToFetch = query.FieldsToFetch,
                IsDistinct = query.IsDistinct,
                SortedFields = query.SortedFields,
                DefaultField = query.DefaultField,
                CutoffEtag = query.CutoffEtag,
                DebugOptionGetIndexEntries = query.DebugOptionGetIndexEntries,
                DefaultOperator = query.DefaultOperator,
                SkippedResults = query.SkippedResults,
                HighlighterPreTags = query.HighlighterPreTags,
                HighlighterPostTags = query.HighlighterPostTags,
                HighlightedFields = query.HighlightedFields,
                HighlighterKeyName = query.HighlighterKeyName,
                ResultsTransformer = query.ResultsTransformer,
                TransformerParameters = query.TransformerParameters,
                ExplainScores = query.ExplainScores,
                SortHints = query.SortHints,
                ShowTimings = query.ShowTimings,
                AllowMultipleIndexEntriesForSameDocumentToResultTransformer = query.AllowMultipleIndexEntriesForSameDocumentToResultTransformer,
                DisableCaching = query.DisableCaching,
                SkipDuplicateChecking = query.SkipDuplicateChecking,
                WaitForNonStaleResults = query.WaitForNonStaleResults
                
            };
            if (indexQuery.SortedFields == null)
                return indexQuery;

            for (int index = 0; index < indexQuery.SortedFields.Length; index++)
            {
                var sortedField = indexQuery.SortedFields[index];
                var fieldName = sortedField.Field;
                bool hasRange = false;
                if (fieldName.EndsWith("_Range"))
                {
                    fieldName = fieldName.Substring(0, fieldName.Length - "_Range".Length);
                    hasRange = true;
                }
            
                var item = map.Items.FirstOrDefault(x => string.Equals(x.QueryFrom, fieldName, StringComparison.InvariantCultureIgnoreCase));
                if (item == null)
                    continue;

                indexQuery.SortedFields[index] = new SortedField(hasRange ? item.To + "_Range" : item.To);
                indexQuery.SortedFields[index].Descending = sortedField.Descending;
            }
            return indexQuery;
        }
Ejemplo n.º 14
0
		public void can_encode_and_decode_IndexQuery_PageSize()
		{
			var expected = Some.Integer();
			var indexQuery = new IndexQuery();

			indexQuery.PageSize = expected;

			IndexQuery result = EncodeAndDecodeIndexQuery(indexQuery);

			Assert.Equal(expected, result.PageSize);
		}
Ejemplo n.º 15
0
		public void can_encode_and_decode_IndexQuery_Start() 
		{
			int expected = Some.Integer();
			var indexQuery = new IndexQuery();

			indexQuery.Start = expected;

			IndexQuery result = EncodeAndDecodeIndexQuery(indexQuery);

			Assert.Equal(expected, result.Start);
		}
Ejemplo n.º 16
0
		public void can_encode_and_decode_IndexQuery_Query_pound() 
		{
			var expected = Some.String() + '#' + Some.String();

			var indexQuery = new IndexQuery();

			indexQuery.Query = expected;

			IndexQuery result = EncodeAndDecodeIndexQuery(indexQuery);

			Assert.Equal(expected, result.Query);
		}
Ejemplo n.º 17
0
		public IEnumerable<string> QueryDocumentIds(string index, IndexQuery query, CancellationTokenSource tokenSource, out bool stale)
		{
			var queryStat = AddToCurrentlyRunningQueryList(index, query, tokenSource);
			try
			{
				bool isStale = false;
				HashSet<string> loadedIds = null;
				TransactionalStorage.Batch(
					actions =>
					{
						var definition = IndexDefinitionStorage.GetIndexDefinition(index);
						if (definition == null)
							throw new ArgumentException("specified index definition was not found", "index");

						isStale = actions.Staleness.IsIndexStale(definition.IndexId, query.Cutoff, null);

						if (isStale == false && query.Cutoff == null)
						{
							var indexInstance = Database.IndexStorage.GetIndexInstance(index);
							isStale = isStale || (indexInstance != null && indexInstance.IsMapIndexingInProgress);
						}

						if (isStale && actions.Staleness.IsIndexStaleByTask(definition.IndexId, query.Cutoff) == false &&
							actions.Staleness.IsReduceStale(definition.IndexId) == false)
						{
							var viewGenerator = IndexDefinitionStorage.GetViewGenerator(index);
							if (viewGenerator == null)
								throw new ArgumentException("specified index definition was not found", "index");

							var forEntityNames = viewGenerator.ForEntityNames.ToList();
							var lastIndexedEtag = actions.Indexing.GetIndexStats(definition.IndexId).LastIndexedEtag;

							if (Database.LastCollectionEtags.HasEtagGreaterThan(forEntityNames, lastIndexedEtag) == false)
								isStale = false;
						}

						var indexFailureInformation = actions.Indexing.GetFailureRate(definition.IndexId);

						if (indexFailureInformation.IsInvalidIndex)
						{
							throw new IndexDisabledException(indexFailureInformation);
						}
						loadedIds = new HashSet<string>(from queryResult in Database.IndexStorage.Query(index, query, result => true, new FieldsToFetch(null, false, Constants.DocumentIdFieldName), Database.IndexQueryTriggers, tokenSource.Token)
														select queryResult.Key);
					});
				stale = isStale;
				return loadedIds;
			}
			finally
			{
				RemoveFromCurrentlyRunningQueryList(index, queryStat);
			}
		}
Ejemplo n.º 18
0
		private RavenJArray PerformBulkOperation(string index, IndexQuery indexQuery, bool allowStale, Func<string, TransactionInformation, object> batchOperation)
		{
			var array = new RavenJArray();
			var bulkIndexQuery = new IndexQuery
			{
				Query = indexQuery.Query,
				Start = indexQuery.Start,
				Cutoff = indexQuery.Cutoff,
                WaitForNonStaleResultsAsOfNow = indexQuery.WaitForNonStaleResultsAsOfNow,
				PageSize = int.MaxValue,
				FieldsToFetch = new[] { Constants.DocumentIdFieldName },
				SortedFields = indexQuery.SortedFields,
				HighlighterPreTags = indexQuery.HighlighterPreTags,
				HighlighterPostTags = indexQuery.HighlighterPostTags,
				HighlightedFields = indexQuery.HighlightedFields,
				SortHints = indexQuery.SortHints
			};

			bool stale;
            var queryResults = database.Queries.QueryDocumentIds(index, bulkIndexQuery, tokenSource, out stale);

			if (stale && allowStale == false)
			{
				throw new InvalidOperationException(
						"Bulk operation cancelled because the index is stale and allowStale is false");
			}

		    var token = tokenSource.Token;

			const int batchSize = 1024;
			using (var enumerator = queryResults.GetEnumerator())
			{
				while (true)
				{
					if (timeout != null)
						timeout.Delay();
					var batchCount = 0;
                    token.ThrowIfCancellationRequested();
					database.TransactionalStorage.Batch(actions =>
					{
						while (batchCount < batchSize && enumerator.MoveNext())
						{
							batchCount++;
							var result = batchOperation(enumerator.Current, transactionInformation);
							array.Add(RavenJObject.FromObject(result));
						}
					});
					if (batchCount < batchSize) break;
				}
			}
			return array;
		}
Ejemplo n.º 19
0
		public QueryResult ExecuteDynamicQuery(string entityName, IndexQuery query)
		{
			// Create the map
			var map = DynamicQueryMapping.Create(documentDatabase, query, entityName);
			
			var touchTemporaryIndexResult = GetAppropriateIndexToQuery(entityName, query, map);

			map.IndexName = touchTemporaryIndexResult.Item1;
			// Re-write the query
			string realQuery = map.Items.Aggregate(query.Query,
												   (current, mapItem) => current.Replace(mapItem.QueryFrom, mapItem.To));

			return ExecuteActualQuery(query, map, touchTemporaryIndexResult, realQuery);
		}
Ejemplo n.º 20
0
		private Tuple<string, bool> GetAppropriateIndexToQuery(string entityName, IndexQuery query, DynamicQueryMapping map)
		{
			var appropriateIndex = new DynamicQueryOptimizer(documentDatabase).SelectAppropriateIndex(entityName, query);
			if (appropriateIndex != null)
			{
				if (appropriateIndex.StartsWith("Temp/"))// temporary index, we need to increase its usage
				{
					return  TouchTemporaryIndex(appropriateIndex, "Auto/" + appropriateIndex.Substring(5),
					                                                () => documentDatabase.IndexDefinitionStorage.GetIndexDefinition(appropriateIndex));
				}
				return Tuple.Create(appropriateIndex, false);
			}
			return TouchTemporaryIndex(map.TemporaryIndexName, map.PermanentIndexName,
			                                                map.CreateIndexDefinition);
		}
        public async Task ReturnTheCampaignsTheUserIsAnOrgAdminFor_WhenOrganizationIdOnMessageIsNotNull()
        {
            const int orgId1 = 1;
            const int orgId2 = 2;

            Context.Campaigns.Add(new Campaign { Id = 1, ManagingOrganization = new Organization { Id = orgId1 }});
            Context.Campaigns.Add(new Campaign { Id = 2, ManagingOrganization = new Organization { Id = orgId2 }});
            Context.SaveChanges();

            var message = new IndexQuery { OrganizationId = orgId1 };

            var sut = new IndexQueryHandler(Context);
            var result = await sut.Handle(message);

            Assert.Equal(result.Single().Id, orgId1);
        }
Ejemplo n.º 22
0
		public QueryResultWithIncludes ExecuteDynamicQuery(string entityName, IndexQuery query, CancellationToken token)
		{
			// Create the map
			var map = DynamicQueryMapping.Create(documentDatabase, query, entityName);
			var touchTemporaryIndexResult = GetAppropriateIndexToQuery(entityName, query, map);

			string realQuery = map.Items.Aggregate(query.Query,
												   (current, mapItem) => current.Replace(mapItem.QueryFrom, mapItem.To));

			UpdateFieldNamesForSortedFields(query, map);

			// We explicitly do NOT want to update the field names of FieldsToFetch - that reads directly from the document
			//UpdateFieldsInArray(map, query.FieldsToFetch);
			
			return ExecuteActualQuery(query, map, touchTemporaryIndexResult, realQuery, token);
		}
Ejemplo n.º 23
0
		public QueryResultWithIncludes ExecuteDynamicQuery(string entityName, IndexQuery query)
		{
			// Create the map
			var map = DynamicQueryMapping.Create(documentDatabase, query, entityName);

			var touchTemporaryIndexResult = GetAppropriateIndexToQuery(entityName, query, map);

			map.IndexName = touchTemporaryIndexResult.Item1;
			// Re-write the query
			string realQuery = map.Items.Aggregate(query.Query,
												   (current, mapItem) => current.Replace(mapItem.QueryFrom, mapItem.To));

			UpdateFieldNamesForSortedFields(query, map);
			UpdateFieldsInArray(map, query.FieldsToFetch);
			UpdateFieldsInArray(map, query.GroupBy);

			return ExecuteActualQuery(query, map, touchTemporaryIndexResult, realQuery);
		}
Ejemplo n.º 24
0
		public void can_encode_and_decode_IndexQuery_Query() 
		{
			//  Fails when at least '&' is in the Query, not sure if that is acceptable
			//  Fails because the value has not by url decoded, I couldn't find code doing the url decode
			//  after GetIndexQueryFromHttpContext() so there may be another bug.

			//var expected = new string(Enumerable.Range(0, 255).Select(i => (char)i)
			//    .Where(c => !Char.IsControl(c)).ToArray());

			var expected = Some.String();

			var indexQuery = new IndexQuery();

			indexQuery.Query = expected;

			IndexQuery result = EncodeAndDecodeIndexQuery(indexQuery);

			Assert.Equal(expected, result.Query);
		}
Ejemplo n.º 25
0
		private QueryResultWithIncludes ExecuteActualQuery(IndexQuery query, DynamicQueryMapping map, Tuple<string, bool> touchTemporaryIndexResult, string realQuery)
		{
			// Perform the query until we have some results at least
			QueryResultWithIncludes result;
			var sp = Stopwatch.StartNew();
			while (true)
			{
				result = documentDatabase.Query(map.IndexName,
												new IndexQuery
												{
													Cutoff = query.Cutoff,
													PageSize = query.PageSize,
													Query = realQuery,
													Start = query.Start,
													FieldsToFetch = query.FieldsToFetch,
													GroupBy = query.GroupBy,
													AggregationOperation = query.AggregationOperation,
													SortedFields = query.SortedFields,
													DefaultField = query.DefaultField,
													CutoffEtag = query.CutoffEtag,
													DebugOptionGetIndexEntries = query.DebugOptionGetIndexEntries,
													DefaultOperator = query.DefaultOperator,
													SkipTransformResults = query.SkipTransformResults,
													SkippedResults = query.SkippedResults,
													HighlighterPreTags = query.HighlighterPreTags,
													HighlighterPostTags = query.HighlighterPostTags,
													HighlightedFields = query.HighlightedFields,
                                                    ResultsTransformer = query.ResultsTransformer,
                                                    QueryInputs = query.QueryInputs
												});

				if (!touchTemporaryIndexResult.Item2 ||
					!result.IsStale ||
					(result.Results.Count >= query.PageSize && query.PageSize > 0) ||
					sp.Elapsed.TotalSeconds > 15)
				{
					return result;
				}

				Thread.Sleep(100);
			}
		}
Ejemplo n.º 26
0
		private RavenJArray PerformBulkOperation(string index, IndexQuery indexQuery, bool allowStale, Func<string, TransactionInformation, object> batchOperation)
		{
			var array = new RavenJArray();
			var bulkIndexQuery = new IndexQuery
			{
				Query = indexQuery.Query,
				Start = indexQuery.Start,
				Cutoff = indexQuery.Cutoff,
				PageSize = int.MaxValue,
				FieldsToFetch = new[] { Constants.DocumentIdFieldName },
				SortedFields = indexQuery.SortedFields
			};

			bool stale;
			var queryResults = database.QueryDocumentIds(index, bulkIndexQuery, out stale);

			if (stale && allowStale == false)
			{
				throw new InvalidOperationException(
						"Bulk operation cancelled because the index is stale and allowStale is false");
			}

			const int batchSize = 1024;
			using (var enumerator = queryResults.GetEnumerator())
			{
				while (true)
				{
					var batchCount = 0;
					database.TransactionalStorage.Batch(actions =>
					{
						while (batchCount < batchSize && enumerator.MoveNext())
						{
							batchCount++;
							var result = batchOperation(enumerator.Current, transactionInformation);
							array.Add(RavenJObject.FromObject(result, JsonExtensions.CreateDefaultJsonSerializer()));
						}
					});
					if (batchCount < batchSize) break;
				}
			}
			return array;
		}
Ejemplo n.º 27
0
		private QueryResultWithIncludes ExecuteActualQuery(IndexQuery query, DynamicQueryMapping map, Tuple<string, bool> touchTemporaryIndexResult, string realQuery)
		{
			// Perform the query until we have some results at least
			QueryResultWithIncludes result;
			var sp = Stopwatch.StartNew();
			while (true)
			{
				var indexQuery = CreateIndexQuery(query, map, realQuery);
				result = documentDatabase.Query(map.IndexName, indexQuery);

				if (!touchTemporaryIndexResult.Item2 ||
					!result.IsStale ||
					(result.Results.Count >= query.PageSize && query.PageSize > 0) ||
					sp.Elapsed.TotalSeconds > 15)
				{
					return result;
				}

				Thread.Sleep(100);
			}
		}
Ejemplo n.º 28
0
        public IEnumerable<string> QueryDocumentIds(string index, IndexQuery query, CancellationToken token, out bool stale)
        {
            var queryStat = AddToCurrentlyRunningQueryList(index, query);
            try
            {
                bool isStale = false;
                HashSet<string> loadedIds = null;
                TransactionalStorage.Batch(
                    actions =>
                    {
                        var definition = IndexDefinitionStorage.GetIndexDefinition(index);
                        if (definition == null)
                            throw new ArgumentException("specified index definition was not found", "index");

                        isStale = actions.Staleness.IsIndexStale(definition.IndexId, query.Cutoff, null);

                        if (isStale == false && query.Cutoff == null)
                        {
                            var indexInstance = Database.IndexStorage.GetIndexInstance(index);
                            isStale = isStale || (indexInstance != null && indexInstance.IsMapIndexingInProgress);
                        }

                        var indexFailureInformation = actions.Indexing.GetFailureRate(definition.IndexId);

                        if (indexFailureInformation.IsInvalidIndex)
                        {
                            throw new IndexDisabledException(indexFailureInformation);
                        }
                        loadedIds = new HashSet<string>(from queryResult in Database.IndexStorage.Query(index, query, result => true, new FieldsToFetch(null, false, Constants.DocumentIdFieldName), Database.IndexQueryTriggers, token)
                                                        select queryResult.Key);
                    });
                stale = isStale;
                return loadedIds;
            }
            finally
            {
                RemoveFromCurrentlyRunningQueryList(index, queryStat);
            }
        }
Ejemplo n.º 29
0
		private QueryResult PerformQueryAgainstDynamicIndex(IHttpContext context, string index, IndexQuery indexQuery, out Guid indexEtag)
		{
			string entityName = null;
			if (index.StartsWith("dynamic/"))
				entityName = index.Substring("dynamic/".Length);

			var dynamicIndexName = Database.FindDynamicIndexName(entityName, indexQuery);


			if (dynamicIndexName != null && 
				Database.IndexStorage.HasIndex(dynamicIndexName))
			{
				indexEtag = GetIndexEtag(dynamicIndexName);
				if (context.MatchEtag(indexEtag))
				{
					context.SetStatusToNotModified();
					return null;
				}
			}
			else
			{
				indexEtag = Guid.Empty;
			}

			var queryResult = Database.ExecuteDynamicQuery(entityName, indexQuery);

			// have to check here because we might be getting the index etag just 
			// as we make a switch from temp to auto, and we need to refresh the etag
			// if that is the case. This can also happen when the optmizer
			// decided to switch indexes for a query.
			if (queryResult.IndexName != dynamicIndexName)
				indexEtag = GetIndexEtag(queryResult.IndexName);

			return queryResult;
		}
Ejemplo n.º 30
0
		private QueryResult PerformQueryAgainstExistingIndex(IHttpContext context, string index, IndexQuery indexQuery, out Guid indexEtag)
		{
			indexEtag = GetIndexEtag(index);
			if (context.MatchEtag(indexEtag))
			{
				context.SetStatusToNotModified();
				return null;
			}

			return Database.Query(index, indexQuery);
		}