public override void ConfigureGlobalQueryBuilders(ElasticQueryBuilder builder)
 {
     builder.Register(new ExceptionlessSystemFilterQueryBuilder());
     builder.Register(new OrganizationIdQueryBuilder());
     builder.Register(new ProjectIdQueryBuilder());
     builder.Register(new StackIdQueryBuilder());
 }
Exemple #2
0
        protected override void ConfigureQueryBuilder(ElasticQueryBuilder builder)
        {
            var stacksRepository = _serviceProvider.GetRequiredService <IStackRepository>();

            base.ConfigureQueryBuilder(builder);
            builder.RegisterBefore <ParsedExpressionQueryBuilder>(new EventStackFilterQueryBuilder(stacksRepository, _configuration.LoggerFactory));
        }
Exemple #3
0
        /// <summary>
        /// Crée le filtre pour une facette sur les autres facettes multi-sélectionnables.
        /// </summary>
        /// <param name="builder">Query builder.</param>
        /// <param name="facet">Facette.</param>
        /// <param name="facetList">Liste des facettes.</param>
        /// <param name="selectedFacets">Facettes sélectionnées.</param>
        /// <param name="facetQueryBuilder">Builder de requête pour une facette.</param>
        /// <returns>La filtre.</returns>
        public static string BuildMultiSelectableFacetFilter(ElasticQueryBuilder builder, IFacetDefinition facet, ICollection <IFacetDefinition> facetList, FacetListInput selectedFacets, Func <string, IFacetDefinition, string, string> facetQueryBuilder)
        {
            return(builder.BuildAndQuery(selectedFacets?
                                         .Select(sf => {
                /* On ne filtre pas sur la facette en cours. */
                if (sf.Key == facet.Code)
                {
                    return null;
                }

                var targetFacet = facetList.Single(f => f.Code == sf.Key);

                /* On n'ajoute que les facettes multi-sélectionnables */
                if (targetFacet.IsMultiSelectable == false)
                {
                    return null;
                }

                return builder.BuildOrQuery(sf.Value
                                            .Select(v => facetQueryBuilder(v, targetFacet, null))
                                            .ToArray());
            })
                                         .Where(sf => sf != null)
                                         .ToArray()));
        }
 public override void ConfigureGlobalQueryBuilders(ElasticQueryBuilder builder)
 {
     builder.Register(new AppFilterQueryBuilder(_appOptions));
     builder.Register(new OrganizationQueryBuilder());
     builder.Register(new ProjectQueryBuilder());
     builder.Register(new StackQueryBuilder());
 }
Exemple #5
0
        public ISearchResult SearchByReferenceCodeWithoutSecurity <T>(string signatur)
            where T : TreeRecord
        {
            Log.Debug($"CheckIsValidSignatur: Signatur:={signatur}");
            var searchSignatur = signatur;

            if (signatur.Contains("\""))
            {
                searchSignatur = signatur.Replace("\"", string.Empty);
            }

            var elasticQuery = new ElasticQuery();
            var query        = ElasticQueryBuilder.CreateQueryForSignatur(searchSignatur);

            elasticQuery.Query = query;

            var found = elasticService.RunQueryWithoutSecurityFilters <T>(elasticQuery);

            Log.Debug("Search.Entities: {0} ({1}ms)",
                      found?.RequestInfo,
                      found?.TimeInMilliseconds);

            if (found?.Exception == null)
            {
                return(CreateSearchResult(found));
            }

            return(CreateErrorResult(found));
        }
        protected virtual IElasticQueryBuilder CreateQueryBuilder()
        {
            var builder = new ElasticQueryBuilder();

            Configuration.ConfigureGlobalQueryBuilders(builder);
            ConfigureQueryBuilder(builder);

            return(builder);
        }
        protected override void ConfigureQueryBuilder(ElasticQueryBuilder builder)
        {
            var aliasMap = new AliasMap {
                { "aliasedage", "age" }
            };

            builder.UseQueryParser(this, c => c
                                   .UseIncludes(i => ResolveInclude(i))
                                   .UseAliases(aliasMap)
                                   );
        }
Exemple #8
0
        public void QueryBuilder_should_return_correct_query_for_string(string searchString, string expectedQueryFileName)
        {
            var sut    = new ElasticQueryBuilder();
            var result = sut.Build(searchString);

            Console.WriteLine(result);

            var expected = GetTestData(expectedQueryFileName);

            // remove spaces and carriage return newline chars to make comparison easier...
            result   = result.Replace("\r", "").Replace("\n", "").Replace(" ", "");
            expected = expected.Replace("\r", "").Replace("\n", "").Replace(" ", "");

            Assert.That(result, Is.EqualTo(expected));
        }
Exemple #9
0
        public ISearchResult Search <T>(SearchParameters search, UserAccess access)
            where T : TreeRecord
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            if (search.Paging == null)
            {
                search.Paging = new Paging {
                    Skip = 0, Take = 10
                };
            }


            Log.Debug("Search: input={0}, query={1}",
                      search,
                      JsonConvert.SerializeObject(search.Query));

            var query = ElasticQueryBuilder.BuildElasticQuery(search, access);
            var found = elasticService.RunQuery <T>(query, access);

            Log.Debug("Search.Entities: {0} ({1}ms)",
                      found?.RequestInfo,
                      found?.TimeInMilliseconds);

            Debug.WriteLine($"Search time: {found?.TimeInMilliseconds:N}ms");

            if (found?.Exception == null)
            {
                var result = CreateSearchResult(found, search.Paging);
                stopwatch.Stop();
                result.ExecutionTimeInMilliseconds = stopwatch.ElapsedMilliseconds;
                return(result);
            }

            return(CreateErrorResult(found));
        }
 protected override void ConfigureQueryBuilder(ElasticQueryBuilder builder)
 {
     builder.Register <CompanyQueryBuilder>();
 }
 public override void ConfigureGlobalQueryBuilders(ElasticQueryBuilder builder) {
     builder.Register<AgeQueryBuilder>();
     builder.Register<CompanyQueryBuilder>();
 }
        public override void ConfigureGlobalQueryBuilders(ElasticQueryBuilder builder)
        {
            builder.Register <OrganizationIdQueryBuilder>();

            base.ConfigureGlobalQueryBuilders(builder);
        }
 public virtual void ConfigureGlobalQueryBuilders(ElasticQueryBuilder builder)
 {
 }
 protected virtual void ConfigureQueryBuilder(ElasticQueryBuilder builder)
 {
 }
Exemple #15
0
 public override void ConfigureGlobalQueryBuilders(ElasticQueryBuilder builder)
 {
     builder.Register <AgeQueryBuilder>();
     builder.Register <CompanyQueryBuilder>();
 }