Exemplo n.º 1
0
        internal Func <SearchDescriptor <T>, ISearchRequest> GetDescriptor(BaseIndexer <T> indexer, bool onlyId = false)
        {
            return(s =>
            {
                var result = s
                             .Query(q => queryContainer)
                             .Index(indexer.IndexName)
                             .Sort(r => sortContainerDescriptor)
                             .From(offset)
                             .Size(limit);

                if (onlyId)
                {
                    result = result.Source(r => r.Includes(a => a.Field("id")));
                }

                return result;
            });
        }
Exemplo n.º 2
0
 public FactoryIndexer(
     IOptionsMonitor <ILog> options,
     FactoryIndexerHelper factoryIndexerSupport,
     TenantManager tenantManager,
     SearchSettingsHelper searchSettingsHelper,
     FactoryIndexer factoryIndexer,
     BaseIndexer <T> baseIndexer,
     Client client,
     IServiceProvider serviceProvider)
 {
     Logger = options.Get("ASC.Indexer");
     FactoryIndexerHelper = factoryIndexerSupport;
     TenantManager        = tenantManager;
     SearchSettingsHelper = searchSettingsHelper;
     FactoryIndexerCommon = factoryIndexer;
     Indexer         = baseIndexer;
     Client          = client;
     ServiceProvider = serviceProvider;
 }
Exemplo n.º 3
0
        internal Func <UpdateByQueryDescriptor <T>, IUpdateByQueryRequest> GetDescriptorForUpdate(BaseIndexer <T> indexer, Func <ScriptDescriptor, IScript> script, bool immediately = true)
        {
            return(s =>
            {
                var result = s
                             .Query(q => queryContainer)
                             .Index(indexer.IndexName)
                             .Script(script);

                if (immediately)
                {
                    result.Refresh();
                }

                return result;
            });
        }
Exemplo n.º 4
0
 internal Func <DeleteByQueryDescriptor <T>, IDeleteByQueryRequest> GetDescriptorForDelete(BaseIndexer <T> indexer, bool immediately = true)
 {
     return(s =>
     {
         var result = s
                      .Query(q => queryContainer)
                      .Index(indexer.IndexName);
         if (immediately)
         {
             result.Refresh();
         }
         return result;
     });
 }