Beispiel #1
0
			public void Execute(Action<RavenJObject> onResult)
			{
				using (new CurrentTransformationScope(database, docRetriever))
				{
					foreach (var result in results)
					{
						cancellationToken.ThrowIfCancellationRequested();
						database.WorkContext.UpdateFoundWork();

						onResult(result);
					}
					if (transformerErrors.Count > 0)
					{
						throw new InvalidOperationException("The transform results function failed.\r\n" + string.Join("\r\n", transformerErrors));
					}
				}

				Result = new QueryResultWithIncludes
				{
					IndexName = indexName,
					IsStale = stale,
					NonAuthoritativeInformation = nonAuthoritativeInformation,
					SkippedResults = query.SkippedResults.Value,
					TotalResults = query.TotalSize.Value,
					IndexTimestamp = indexTimestamp.Item1,
					IndexEtag = indexTimestamp.Item2,
					ResultEtag = resultEtag,
					IdsToInclude = idsToLoad,
					LastQueryTime = SystemTime.UtcNow,
					Highlightings = highlightings,
					DurationMilliseconds = duration.ElapsedMilliseconds,
					ScoreExplanations = scoreExplanations,
					TimingsInMilliseconds = NormalizeTimings()
				};
			}
Beispiel #2
0
	    private static void ReportQuery(StringBuilder sb, IndexQuery indexQuery, Stopwatch sp, QueryResultWithIncludes result)
	    {
	        sb.Append("\tQuery: ")
	            .Append(indexQuery.Query)
	            .AppendLine();
	        sb.Append("\t").AppendFormat("Time: {0:#,#;;0} ms", sp.ElapsedMilliseconds).AppendLine();

	        if (result == null)
	            return;

	        sb.Append("\tIndex: ")
	            .AppendLine(result.IndexName);
	        sb.Append("\t").AppendFormat("Results: {0:#,#;;0} returned out of {1:#,#;;0} total.", result.Results.Count, result.TotalResults).AppendLine();

			if (result.TimingsInMilliseconds != null)
			{
				sb.Append("\tTiming:").AppendLine();
			    foreach (var timing in result.TimingsInMilliseconds)
			    {
				    sb.Append("\t").Append(timing.Key).Append(": ").Append(timing.Value).AppendLine();
			    }
		    }
	    }