public ExecutingQueryInfo(DateTime startTime, IIndexQuery queryInfo, long queryId, OperationCancelToken token)
 {
     StartTime  = startTime;
     QueryInfo  = queryInfo;
     QueryId    = queryId;
     _stopwatch = Stopwatch.StartNew();
     Token      = token;
 }
示例#2
0
 public ExecutingQueryInfo(DateTime startTime, string indexName, IIndexQuery queryInfo, long queryId, bool isStreaming, OperationCancelToken token)
 {
     StartTime   = startTime;
     IndexName   = indexName;
     QueryInfo   = queryInfo;
     QueryId     = queryId;
     IsStreaming = isStreaming;
     _stopwatch  = Stopwatch.StartNew();
     Token       = token;
 }
        public static void WriteIndexQuery(this BlittableJsonTextWriter writer, JsonOperationContext context, IIndexQuery query)
        {
            var indexQuery = query as IndexQueryServerSide;

            if (indexQuery != null)
            {
                writer.WriteIndexQuery(context, indexQuery);
                return;
            }

            var moreLikeThisQuery = query as MoreLikeThisQueryServerSide;

            if (moreLikeThisQuery != null)
            {
                writer.WriteMoreLikeThisQuery(context, moreLikeThisQuery);
                return;
            }

            var facetQuery = query as FacetQuery;

            if (facetQuery != null)
            {
                writer.WriteFacetQuery(context, facetQuery);
                return;
            }

            throw new NotSupportedException($"Not supported query type: {query.GetType()}");
        }
示例#4
0
 /// <summary>
 /// Asynchronously materializes indexed query result
 /// </summary>
 /// <typeparam name="T">Type of the entity class</typeparam>
 /// <typeparam name="K">Type of the index</typeparam>
 /// <param name="query">Indexed query to execute</param>
 /// <returns>Awaitable Task with enumeration of loaded entities in result</returns>
 public static Task <List <T> > ToListAsync <T, K>(this IIndexQuery <T, K> query) where T : class
 {
     return(TaskEx.Run(() => query.ToList()));
 }
示例#5
0
 /// <summary>
 /// Asynchronously materializes indexed query result
 /// </summary>
 /// <typeparam name="T">Type of the entity class</typeparam>
 /// <typeparam name="K1">Type of the first component index</typeparam>
 /// <typeparam name="K2">Type of the second component index</typeparam>
 /// <typeparam name="K3">Type of the third component index</typeparam>
 /// <param name="query">Indexed query to count result</param>
 /// <returns>Awaitable Task with number of entities in result</returns>
 public static Task <int> CountAsync <T, K1, K2, K3>(this IIndexQuery <T, K1, K2, K3> query) where T : class
 {
     return(TaskEx.Run(() => query.Count()));
 }
示例#6
0
 /// <summary>
 /// Asynchronously materializes indexed query lazy result
 /// </summary>
 /// <typeparam name="T">Type of the entity class</typeparam>
 /// <typeparam name="K1">Type of the first component index</typeparam>
 /// <typeparam name="K2">Type of the second component index</typeparam>
 /// <typeparam name="K3">Type of the third component index</typeparam>
 /// <param name="query">Indexed query to execute</param>
 /// <returns>Awaitable Task with enumeration of loaded entities in result</returns>
 public static Task <List <Lazy <T, K1, K2, K3> > > ToLazyListAsync <T, K1, K2, K3>(this IIndexQuery <T, K1, K2, K3> query) where T : class
 {
     return(TaskEx.Run(() => query.ToLazyList()));
 }