Esempio n. 1
0
        public static async Task <QueryContainer> BuildQueryAsync <T>(this IElasticQueryBuilder builder, IRepositoryQuery query, ICommandOptions options, SearchDescriptor <T> search) where T : class, new()
        {
            var ctx = new QueryBuilderContext <T>(query, options, search);
            await builder.BuildAsync(ctx).AnyContext();

            return(new BoolQuery {
                Must = new[] { ctx.Query },
                Filter = new[] { ctx.Filter ?? new MatchAllQuery() }
            });
        }
        public static async Task <QueryContainer> BuildQueryAsync <T>(this IElasticQueryBuilder builder, IRepositoryQuery query, IQueryOptions options, SearchDescriptor <T> search) where T : class, new()
        {
            var ctx = new QueryBuilderContext <T>(query, options, search);
            await builder.BuildAsync(ctx).AnyContext();

            return(new FilteredQuery {
                Filter = ctx.Filter,
                Query = ctx.Query
            });
        }