Пример #1
0
        public ElasticSearchBuilder(string indexName, IElasticSearchService elasticSearchService)
        {
            IndexName = indexName;
            this._elasticSearchService = elasticSearchService;

            QueryContainer = new QueryContainer();
        }
Пример #2
0
 public PostManager(IPostDal postDal, IElasticSearchService elasticSearchService, ITagService tagService, IUserService userService)
 {
     _postDal = postDal;
     _elasticSearchService = elasticSearchService;
     _tagService           = tagService;
     _userService          = userService;
 }
 public OrderWorkerService(ILogger <OrderWorkerService> logger, IEventStoreConnection eventStore, IElasticSearchService elasticSearchService, IMapper mapper)
 {
     _logger               = logger;
     _eventStore           = eventStore;
     _elasticSearchService = elasticSearchService;
     _mapper               = mapper;
 }
        public override IEnumerable <SearchResult> Search(Query query)
        {
            var         contentSearchHits = new List <ContentSearchHit <TContentData> >();
            CultureInfo language          = Language.GetRequestLanguage();

            if (!query.SearchRoots.Any() || ForceRootLookup)
            {
                query.SearchRoots = new[] { GetSearchRoot() };
            }

            foreach (string searchRoot in query.SearchRoots)
            {
                if (!Int32.TryParse(searchRoot, out int searchRootId) && searchRoot.Contains("__"))
                {
                    Int32.TryParse(searchRoot.Split(new[] { "__" }, StringSplitOptions.None)[0], out searchRootId);
                }

                if (searchRootId != 0)
                {
                    IElasticSearchService <TContentData> searchQuery = CreateQuery(query, language, searchRootId);

                    ContentSearchResult <TContentData> contentSearchResult =
                        searchQuery.GetContentResults(false, true, GetProviderKeys(), false, false);

                    contentSearchHits.AddRange(contentSearchResult.Hits);
                }
            }

            return
                (contentSearchHits.OrderByDescending(hit => hit.Score)
                 .Take(_elasticSearchSettings.ProviderMaxResults)
                 .Select(hit => CreateSearchResult(hit.Content)));
        }
Пример #5
0
        public static async Task <ContentSearchResult <T> > GetContentResultsAsync <T>(
            this IElasticSearchService <T> service,
            CancellationToken cancellationToken,
            bool requirePageTemplate,
            bool ignoreFilters,
            string[] providerNames,
            bool enableHighlighting,
            bool enableDidYouMean) where T : IContentData
        {
            SearchResult results = await service.GetResultsAsync(cancellationToken, enableHighlighting, enableDidYouMean, !ignoreFilters, DefaultFields.Id).ConfigureAwait(false);

            IEnumerable <Task <ContentSearchHit <T> > > tasks =
                results.Hits.Select(h => FilterAsync <T>(h, requirePageTemplate, providerNames, ignoreFilters));

            ContentSearchHit <T>[] hits = await Task.WhenAll(tasks).ConfigureAwait(false);

            hits = hits.Where(h => h != null).ToArray();

            results.TotalHits -= hits.Count(h => h == null);

            if (service.TrackSearch)
            {
                TrackingRepository.AddSearch(
                    Language.GetLanguageCode(service.SearchLanguage),
                    service.SearchText,
                    results.TotalHits == 0,
                    GetIndexName(service));
            }

            return(new ContentSearchResult <T>(results, hits));
        }
Пример #6
0
        public SearchController(IElasticSearchService _elasticSearchService, IRabbitManager _manager)
        {
            elasticSearchService = _elasticSearchService;
            client = elasticSearchService.getClient();

            manager = _manager;
        }
        /// <summary>
        /// Get auto-suggestions for the indexed word beginning with the supplied term.
        /// </summary>
        /// <param name="service">The <see cref="IElasticSearchService"/> instance</param>
        /// <param name="searchText">The term to search for</param>
        /// <returns>An array of matching words</returns>
        public static string[] GetSuggestions <T>(this IElasticSearchService <T> service, string searchText)
        {
            var settings = ServiceLocator.Current.GetInstance <IElasticSearchSettings>();
            var engine   = new SearchEngine(settings);

            return(GetSuggestions(service, searchText, engine));
        }
Пример #8
0
        public static IElasticSearchService <T> Filter <T>(this IElasticSearchService <T> service,
                                                           Expression <Func <T, CategoryList> > fieldSelector, string filterValue)
        {
            Tuple <string, MappingType> fieldInfo = ElasticSearchService <T> .GetFieldInfo(fieldSelector);

            return(service.Filter(fieldInfo.Item1, filterValue, false));
        }
 public ProductAppService(IElasticSearchService elasticSearchService,
                          IMediatorHandler mediatorHandler, IMapper mapper)
 {
     _elasticSearchService = elasticSearchService;
     _mediatorHandler      = mediatorHandler;
     _mapper = mapper;
 }
Пример #10
0
 public CustomerAppService(IElasticSearchService elasticSearchService, IMediatorHandler mediator
                           , IMapper mapper)
 {
     _elasticSearchService = elasticSearchService;
     _mapper   = mapper;
     _mediator = mediator;
 }
 public SupplierAppService(IMediatorHandler mediatorHandler, IMapper mapper
                           , IElasticSearchService elasticSearchService)
 {
     _mediatorHandler      = mediatorHandler;
     _mapper               = mapper;
     _elasticSearchService = elasticSearchService;
 }
Пример #12
0
 public SearchController(IElasticSearchService _elasticSearch,
                         IProductElasticService _productElasticService,
                         IRedisService redisService)
 {
     this._elasticSearch         = _elasticSearch;
     this._productElasticService = _productElasticService;
     this._redisService          = redisService;
 }
Пример #13
0
 /// <summary>
 /// this is a default constructor for EmployeeController
 /// </summary>
 /// <param name="employeeService">object of employee service for dependency injection</param>
 public EmployeeController(IEmployeeService employeeService, IAWSServices awsService, IMapper mapper, IDepartmentDesignationService departmentDesignationService, IElasticSearchService elasticSearchService)
 {
     _employeeService = employeeService;
     _awsService      = awsService;
     _mapper          = mapper;
     _departmentDesignationService = departmentDesignationService;
     _elasticSearchService         = elasticSearchService;
 }
Пример #14
0
 public EventService(ISlackHttpClient slackClient, IElasticSearchService elasticSearchService,
                     ISearchableTextService searchableTextService, ILogger <EventService> logger)
 {
     _slackClient           = slackClient;
     _elasticSearchService  = elasticSearchService;
     _searchableTextService = searchableTextService;
     _logger = logger;
 }
Пример #15
0
 public ProductSearchService(IElasticSearchService elasticSearchService,
                             ISearchFiltersService <ProductIndexItem> searchFiltersService,
                             IMapper mapper)
 {
     _elasticSearchService = elasticSearchService;
     _searchFiltersService = searchFiltersService;
     _mapper = mapper;
 }
Пример #16
0
 public ElasticSearchEngine(ElasticSearchBuilder elasticSearchBuilder)
 {
     _indexName           = elasticSearchBuilder.IndexName;
     _size                = elasticSearchBuilder.Size;
     _from                = elasticSearchBuilder.From;
     _queryContainer      = elasticSearchBuilder.QueryContainer;
     elasticSearchService = elasticSearchBuilder._elasticSearchService;
 }
Пример #17
0
 protected BaseIndexer(ILogger <BaseIndexer <TIndex, TEntity> > logger,
                       IElasticSearchService elasticSearchService,
                       IIndexConverter <TIndex, TEntity> converter)
 {
     _converter            = converter ?? throw new ArgumentNullException(nameof(converter));
     _elasticSearchService = elasticSearchService ?? throw new ArgumentNullException(nameof(elasticSearchService));
     Logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public GeneralRepository(DevnotContext context, IEncryption encryption, IOptions <ElasticConnectionSettings> elasticConfig, IElasticSearchService <AuditLogModel> elasticAuditLogService)
 {
     _context                = context;
     _entities               = context.Set <T>();
     _encryption             = encryption;
     _elasticConfig          = elasticConfig;
     _elasticAuditLogService = elasticAuditLogService;
 }
 public OrderAppService(IElasticSearchService elasticSearchService, IMediatorHandler mediatorHandler,
                        IMapper mapper, IProductRepository productRepository, IOrderRepository orderRepository)
 {
     _elasticSearchService = elasticSearchService;
     _mediatorHandler      = mediatorHandler;
     _mapper            = mapper;
     _productRepository = productRepository;
     _orderRepository   = orderRepository;
 }
 public CostStageRevisionStatusChangedHandler(
     ILogger logger,
     IEnumerable <Lazy <IPaperpusherNotifier, PluginMetadata> > paperpusherNotifiers,
     IElasticSearchService elasticSearchService)
 {
     _logger = logger;
     _paperpusherNotifiers = paperpusherNotifiers;
     _elasticSearchService = elasticSearchService;
 }
 public RabbitElasticLogsService(RabbitQueue rabbitEnum, IModel channel, IOptions <SeriLogSetting> settings, IServiceProvider serviceProvider)
 {
     _rabbitEnum           = rabbitEnum;
     _channel              = channel;
     _elasticSearchService = serviceProvider.GetRequiredService <IElasticSearchService>();
     _seriLogSetting       = settings.Value;
     baseDir = _seriLogSetting.baseDir;
     logfile = Path.Combine(baseDir, _seriLogSetting.App_Data, _seriLogSetting.logs, _seriLogSetting.log);
 }
Пример #22
0
        /// <summary>
        /// Get auto-suggestions for the indexed word beginning with the supplied term.
        /// </summary>
        /// <param name="service">The <see cref="IElasticSearchService"/> instance</param>
        /// <param name="searchText">The term to search for</param>
        /// <returns>An array of matching words</returns>
        public static string[] GetSuggestions <T>(this IElasticSearchService <T> service, string searchText)
        {
            var settings   = ServiceLocator.Current.GetInstance <IElasticSearchSettings>();
            var client     = ServiceLocator.Current.GetInstance <IHttpClientHelper>();
            var serverInfo = ServiceLocator.Current.GetInstance <IServerInfoService>();
            var engine     = new SearchEngine(serverInfo, settings, client);

            return(GetSuggestions(service, searchText, engine));
        }
Пример #23
0
 public MailService(
     IElasticSearchService <T> elasticSearchService,
     IRabbitMQService <T> rabbitMqService,
     IMailHelper <MailRequest> mailHelper)
 {
     this.elasticSearchService = elasticSearchService;
     this.rabbitMqService      = rabbitMqService;
     this.mailHelper           = mailHelper;
 }
Пример #24
0
 public ProductManager(dbContext context, IElasticSearchService elasticSearchService, IPropertyManager propertyManager,
                       ICategoryManager categoryManager, IStockManager stockManager)
 {
     _context = context;
     _elasticSearchService = elasticSearchService;
     _propertyManager      = propertyManager;
     _categoryManager      = categoryManager;
     _stockManager         = stockManager;
 }
        public static CatalogSearchResult <T> GetCatalogResults <T>(this IElasticSearchService <T> service)
            where T : EntryContentBase
        {
            service.UseIndex(GetIndexName(service.SearchLanguage));

            SearchResult results = service.GetResults();

            return(GetCatalogSearchResult(service, results));
        }
Пример #26
0
 public CategoryIndexItemIndexer(ICategoryRepository categoryRepository,
                                 ILogger <BasePagedIndexer <CategoryIndexItem, CategoryDbModel> > logger,
                                 IElasticSearchService elasticSearchService,
                                 IIndexConverter <CategoryIndexItem, CategoryDbModel> converter,
                                 IPagedIndexerConfiguration configuration)
     : base(logger, elasticSearchService, converter, configuration)
 {
     _categoryRepository = categoryRepository;
 }
Пример #27
0
 public SupplierIndexItemIndexer(ISupplierRepository supplierRepository,
                                 ILogger <BasePagedIndexer <SupplierIndexItem, SupplierDbModel> > logger,
                                 IElasticSearchService elasticSearchService,
                                 IIndexConverter <SupplierIndexItem, SupplierDbModel> converter,
                                 IPagedIndexerConfiguration configuration)
     : base(logger, elasticSearchService, converter, configuration)
 {
     _supplierRepository = supplierRepository;
 }
        private static CatalogSearchResult <T> GetCatalogSearchResult <T>(IElasticSearchService <T> service, SearchResult results) where T : EntryContentBase
        {
            var hits = new List <CatalogSearchHit <T> >();

            foreach (SearchHit hit in results.Hits)
            {
                if (hit.ShouldAdd(false, out T content, new[] { ProviderConstants.CatalogProviderKey }, false))
                {
                    hits.Add(new CatalogSearchHit <T>(content, hit.CustomProperties, hit.QueryScore, hit.Highlight));
                }
 public RabbitMQService(IConnectionFactory connectionFactory,
                        IConfiguration configuration,
                        IElasticSearchService elasticService,
                        IOptions <List <ConfiguracaoProcesso> > configuracaoesProcessos)
 {
     _connectionFactory       = connectionFactory as ConnectionFactory;
     _configuration           = configuration;
     _elasticService          = elasticService;
     _configuracaoesProcessos = configuracaoesProcessos.Value;
 }
Пример #30
0
 public ElasticReorganizer(IElasticSearchService elasticSearchService,
                           IProductDAL productDAL,
                           ICategoryDAL categoryDAL,
                           ISupplierDAL supplierDAL)
 {
     _elasticSearchService = elasticSearchService;
     _productDAL           = productDAL;
     _categoryDAL          = categoryDAL;
     _supplierDAL          = supplierDAL;
 }
        public SearchParamsViewModel(IElasticSearchService elasticSearchService)
        {
            var departures = new List<Airport>
                {
                    new Airport { Code = "", Name = "Where do you want to fly from"},
                    new Airport { Code = "ABZ", Name = "Aberdeen (ABZ)"},
                    new Airport { Code = "BHD", Name = "Belfast City (BHD)"},
                    new Airport { Code = "BFS", Name = "Belfast International (BFS)"},
                    new Airport { Code = "BHX", Name = "Birmingham (BHX)"},
                    new Airport { Code = "BOH", Name = "Bournemouth (BOH)"},
                    new Airport { Code = "BRS", Name = "Bristol (BRS)"},
                    new Airport { Code = "CWL", Name = "Cardiff (CWL)"},
                    new Airport { Code = "LDY", Name = "City of Derry (LDY)"},
                    new Airport { Code = "DSA", Name = "Doncaster Sheffield (DSA)"},
                    new Airport { Code = "DUB", Name = "Dublin (DUB)"},
                    new Airport { Code = "MME", Name = "Durham Tees Valley (MME)"},
                    new Airport { Code = "EMA", Name = "East Midlands (EMA)"},
                    new Airport { Code = "EDI", Name = "Edinburgh (EDI)"},
                    new Airport { Code = "EXT", Name = "Exeter (EXT)"},
                    new Airport { Code = "GLA", Name = "Glasgow (GLA)"},
                    new Airport { Code = "LBA", Name = "Leeds Bradford (LBA)"},
                    new Airport { Code = "LGW", Name = "London Gatwick (LGW)"},
                    new Airport { Code = "LTN", Name = "London Luton (LTN)"},
                    new Airport { Code = "SEN", Name = "London Southend (SEN)"},
                    new Airport { Code = "STN", Name = "London Stansted (STN)"},
                    new Airport { Code = "MAN", Name = "Manchester (MAN)"},
                    new Airport { Code = "NCL", Name = "Newcastle (NCL)"},
                    new Airport { Code = "NWI", Name = "Norwich (NWI)"},
                    new Airport { Code = "SNN", Name = "Shannon (SNN)"},
                    new Airport { Code = "SOU", Name = "Southampton (SOU)"}
                };


            var destinations = new List<Airport>
                {
                    new Airport {Code = "ANYWHERE", Name = "Going to... (optional)"},
                    new Airport {Code = "AGA", Name = "Agadir (AGA)"},
                    new Airport {Code = "ALC", Name = "Alicante (ALC)"},
                    new Airport {Code = "LEI", Name = "Almeria (LEI)"},
                    new Airport {Code = "GPA", Name = "Araxos (GPA)"},
                    new Airport {Code = "AUA", Name = "Aruba (AUA)"},
                    new Airport {Code = "BHD", Name = "Belfast City (BHD)"},
                    new Airport {Code = "BFS", Name = "Belfast International (BFS)"},
                    new Airport {Code = "BOJ", Name = "Bulgaria, Bourgas (BOJ)"},
                    new Airport {Code = "BVC", Name = "Cape Verde, Boa Vista (BVC)"},
                    new Airport {Code = "SID", Name = "Cape Verde, Sal (SID)"},
                    new Airport {Code = "CHQ", Name = "Chania (CHQ)"},
                    new Airport {Code = "CFU", Name = "Corfu (CFU)"},
                    new Airport {Code = "PUY", Name = "Croatia, Pula (PUY)"},
                    new Airport {Code = "POP", Name = "Dom. Rep., Puerto Plata (POP)"},
                    new Airport {Code = "PUJ", Name = "Dom. Rep., Punta Cana (PUJ)"},
                    new Airport {Code = "DBV", Name = "Dubrovnik (DBV)"},
                    new Airport {Code = "HRG", Name = "Egypt, Hurghada (HRG)"},
                    new Airport {Code = "LXR", Name = "Egypt, Luxor (LXR)"},
                    new Airport {Code = "RMF", Name = "Egypt, Marsa Alam (RMF)"},
                    new Airport {Code = "SSH", Name = "Egypt, Sharm El Sheikh (SSH)"},
                    new Airport {Code = "FAO", Name = "Faro (FAO)"},
                    new Airport {Code = "FUE", Name = "Fuerteventura (FUE)"},
                    new Airport {Code = "FNC", Name = "Funchal (FNC)"},
                    new Airport {Code = "GRO", Name = "Gerona (GRO)"},
                    new Airport {Code = "LPA", Name = "Gran Canaria (LPA)"},
                    new Airport {Code = "HER", Name = "Heraklion (HER)"},
                    new Airport {Code = "IBZ", Name = "Ibiza (IBZ)"},
                    new Airport {Code = "MBJ", Name = "Jamaica, Montego Bay (MBJ)"},
                    new Airport {Code = "XRY", Name = "Jerez (XRY)"},
                    new Airport {Code = "KVA", Name = "Kavala (KVA)"},
                    new Airport {Code = "EFL", Name = "Kefalonia (EFL)"},
                    new Airport {Code = "MBA", Name = "Kenya, Mombasa (MBA)"},
                    new Airport {Code = "KGS", Name = "Kos (KGS)"},
                    new Airport {Code = "SPC", Name = "La Palma (SPC)"},
                    new Airport {Code = "ACE", Name = "Lanzarote (ACE)"},
                    new Airport {Code = "LCA", Name = "Larnaca (LCA)"},
                    new Airport {Code = "LGW", Name = "London Gatwick (LGW)"},
                    new Airport {Code = "LTN", Name = "London Luton (LTN)"},
                    new Airport {Code = "SEN", Name = "London Southend (SEN)"},
                    new Airport {Code = "STN", Name = "London Stansted (STN)"},
                    new Airport {Code = "AGP", Name = "Malaga (AGP)"},
                    new Airport {Code = "MLA", Name = "Malta (MLA)"},
                    new Airport {Code = "RAK", Name = "Marrakech (RAK)"},
                    new Airport {Code = "MRU", Name = "Mauritius (MRU)"},
                    new Airport {Code = "MAH", Name = "Menorca (MAH)"},
                    new Airport {Code = "CUN", Name = "Mexico, Cancun (CUN)"},
                    new Airport {Code = "PVR", Name = "Mexico, Puerto Vallarta (PVR)"},
                    new Airport {Code = "JMK", Name = "Mykonos (JMK)"},
                    new Airport {Code = "NAP", Name = "Naples (NAP)"},
                    new Airport {Code = "PMI", Name = "Palma Mallorca (PMI)"},
                    new Airport {Code = "PFO", Name = "Paphos (PFO)"},
                    new Airport {Code = "PXO", Name = "Porto Santo (PXO)"},
                    new Airport {Code = "PVK", Name = "Preveza (PVK)"},
                    new Airport {Code = "REU", Name = "Reus (REU)"},
                    new Airport {Code = "RHO", Name = "Rhodes (RHO)"},
                    new Airport {Code = "SMI", Name = "Samos (SMI)"},
                    new Airport {Code = "JTR", Name = "Santorini (JTR)"},
                    new Airport {Code = "AHO", Name = "Sardinia, Alghero (AHO)"},
                    new Airport {Code = "CTA", Name = "Sicily, Catania (CTA)"},
                    new Airport {Code = "JSI", Name = "Skiathos (JSI)"},
                    new Airport {Code = "TFS", Name = "Tenerife South (TFS)"},
                    new Airport {Code = "SKG", Name = "Thessaloniki (SKG)"},
                    new Airport {Code = "DJE", Name = "Tunisia, Djerba (DJE)"},
                    new Airport {Code = "NBE", Name = "Tunisia, Enfidha (NBE)"},
                    new Airport {Code = "ADB", Name = "Turkey, Adnan Menderes (ADB)"},
                    new Airport {Code = "AYT", Name = "Turkey, Antalya (AYT)"},
                    new Airport {Code = "BJV", Name = "Turkey, Bodrum (BJV)"},
                    new Airport {Code = "DLM", Name = "Turkey, Dalaman (DLM)"},
                    new Airport {Code = "VCE", Name = "Venice (VCE)"},
                    new Airport {Code = "ZTH", Name = "Zante (ZTH)"},
                };

            Departures = departures;
            Destinations = destinations;
        }
Пример #32
0
 public FlightController(IElasticSearchService elasticSearchService)
 {
     _elasticSearchService = elasticSearchService;
 }
Пример #33
0
 public WatchController(IElasticSearchService elasticSearchService)
 {
     _elasticSearchService = elasticSearchService;
 }