类org.apache.lucene.search.QueryCachingPolicy源码实例Demo

下面列出了怎么用org.apache.lucene.search.QueryCachingPolicy的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Elasticsearch   文件: IndexShard.java
private final EngineConfig newEngineConfig(TranslogConfig translogConfig, QueryCachingPolicy cachingPolicy) {
    final TranslogRecoveryPerformer translogRecoveryPerformer = new TranslogRecoveryPerformer(shardId, mapperService,
            queryParserService,
            indexAliasesService, indexCache, logger) {
        @Override
        protected void operationProcessed() {
            assert recoveryState != null;
            recoveryState.getTranslog().incrementRecoveredOperations();
        }

        @Override
        public int recoveryFromSnapshot(Engine engine, Translog.Snapshot snapshot) throws IOException {
            assert recoveryState != null;
            RecoveryState.Translog translogStats = recoveryState.getTranslog();
            translogStats.totalOperations(snapshot.estimatedTotalOperations());
            translogStats.totalOperationsOnStart(snapshot.estimatedTotalOperations());
            return super.recoveryFromSnapshot(engine, snapshot);
        }
    };
    return new EngineConfig(shardId,
            threadPool, indexingService, indexSettingsService.indexSettings(), warmer, store, deletionPolicy, mergePolicyConfig
            .getMergePolicy(), mergeSchedulerConfig,
            mapperService.indexAnalyzer(), similarityService.similarity(), codecService, failedEngineListener,
            translogRecoveryPerformer, indexCache.query(), cachingPolicy, wrappingService, translogConfig);
}
 
源代码2 项目: Elasticsearch   文件: EngineConfig.java
/**
 * Creates a new {@link org.elasticsearch.index.engine.EngineConfig}
 */
public EngineConfig(ShardId shardId, ThreadPool threadPool, ShardIndexingService indexingService,
                    Settings indexSettings, IndicesWarmer warmer, Store store, SnapshotDeletionPolicy deletionPolicy,
                    MergePolicy mergePolicy, MergeSchedulerConfig mergeSchedulerConfig, Analyzer analyzer,
                    Similarity similarity, CodecService codecService, Engine.FailedEngineListener failedEngineListener,
                    TranslogRecoveryPerformer translogRecoveryPerformer, QueryCache queryCache, QueryCachingPolicy queryCachingPolicy, IndexSearcherWrappingService wrappingService, TranslogConfig translogConfig) {
    this.shardId = shardId;
    this.indexSettings = indexSettings;
    this.threadPool = threadPool;
    this.indexingService = indexingService;
    this.warmer = warmer;
    this.store = store;
    this.deletionPolicy = deletionPolicy;
    this.mergePolicy = mergePolicy;
    this.mergeSchedulerConfig = mergeSchedulerConfig;
    this.analyzer = analyzer;
    this.similarity = similarity;
    this.codecService = codecService;
    this.failedEngineListener = failedEngineListener;
    this.wrappingService = wrappingService;
    this.optimizeAutoGenerateId = indexSettings.getAsBoolean(EngineConfig.INDEX_OPTIMIZE_AUTOGENERATED_ID_SETTING, false);
    this.compoundOnFlush = indexSettings.getAsBoolean(EngineConfig.INDEX_COMPOUND_ON_FLUSH, compoundOnFlush);
    codecName = indexSettings.get(EngineConfig.INDEX_CODEC_SETTING, EngineConfig.DEFAULT_CODEC_NAME);
    // We start up inactive and rely on IndexingMemoryController to give us our fair share once we start indexing:
    indexingBufferSize = IndexingMemoryController.INACTIVE_SHARD_INDEXING_BUFFER;
    gcDeletesInMillis = indexSettings.getAsTime(INDEX_GC_DELETES_SETTING, EngineConfig.DEFAULT_GC_DELETES).millis();
    versionMapSizeSetting = indexSettings.get(INDEX_VERSION_MAP_SIZE, DEFAULT_VERSION_MAP_SIZE);
    updateVersionMapSize();
    this.translogRecoveryPerformer = translogRecoveryPerformer;
    this.forceNewTranslog = indexSettings.getAsBoolean(INDEX_FORCE_NEW_TRANSLOG, false);
    this.queryCache = queryCache;
    this.queryCachingPolicy = queryCachingPolicy;
    this.translogConfig = translogConfig;
}
 
源代码3 项目: Elasticsearch   文件: EngineConfig.java
/**
 * Return the policy to use when caching queries.
 */
public QueryCachingPolicy getQueryCachingPolicy() {
    return queryCachingPolicy;
}
 
源代码4 项目: Elasticsearch   文件: IndexShard.java
public QueryCachingPolicy getQueryCachingPolicy() {
    return this.engineConfig.getQueryCachingPolicy();
}
 
源代码5 项目: Elasticsearch   文件: NoneQueryCache.java
@Override
public Weight doCache(Weight weight, QueryCachingPolicy policy) {
    return weight;
}
 
源代码6 项目: Elasticsearch   文件: IndexQueryCache.java
@Override
public Weight doCache(Weight weight, QueryCachingPolicy policy) {
    return indicesQueryCache.doCache(weight, policy);
}
 
源代码7 项目: crate   文件: EngineConfig.java
/**
 * Creates a new {@link org.elasticsearch.index.engine.EngineConfig}
 */
public EngineConfig(ShardId shardId,
                    String allocationId,
                    ThreadPool threadPool,
                    IndexSettings indexSettings,
                    Store store,
                    MergePolicy mergePolicy,
                    Analyzer analyzer,
                    CodecService codecService,
                    Engine.EventListener eventListener,
                    QueryCache queryCache,
                    QueryCachingPolicy queryCachingPolicy,
                    TranslogConfig translogConfig,
                    TimeValue flushMergesAfter,
                    List<ReferenceManager.RefreshListener> externalRefreshListener,
                    List<ReferenceManager.RefreshListener> internalRefreshListener,
                    CircuitBreakerService circuitBreakerService,
                    LongSupplier globalCheckpointSupplier,
                    LongSupplier primaryTermSupplier,
                    TombstoneDocSupplier tombstoneDocSupplier) {
    this.shardId = shardId;
    this.allocationId = allocationId;
    this.indexSettings = indexSettings;
    this.threadPool = threadPool;
    this.store = store;
    this.mergePolicy = mergePolicy;
    this.analyzer = analyzer;
    this.codecService = codecService;
    this.eventListener = eventListener;
    codecName = indexSettings.getValue(INDEX_CODEC_SETTING);
    // We need to make the indexing buffer for this shard at least as large
    // as the amount of memory that is available for all engines on the
    // local node so that decisions to flush segments to disk are made by
    // IndexingMemoryController rather than Lucene.
    // Add an escape hatch in case this change proves problematic - it used
    // to be a fixed amound of RAM: 256 MB.
    // TODO: Remove this escape hatch in 8.x
    final String escapeHatchProperty = "es.index.memory.max_index_buffer_size";
    String maxBufferSize = System.getProperty(escapeHatchProperty);
    if (maxBufferSize != null) {
        indexingBufferSize = MemorySizeValue.parseBytesSizeValueOrHeapRatio(maxBufferSize, escapeHatchProperty);
    } else {
        indexingBufferSize = IndexingMemoryController.INDEX_BUFFER_SIZE_SETTING.get(indexSettings.getNodeSettings());
    }
    this.queryCache = queryCache;
    this.queryCachingPolicy = queryCachingPolicy;
    this.translogConfig = translogConfig;
    this.flushMergesAfter = flushMergesAfter;
    this.externalRefreshListener = externalRefreshListener;
    this.internalRefreshListener = internalRefreshListener;
    this.circuitBreakerService = circuitBreakerService;
    this.globalCheckpointSupplier = globalCheckpointSupplier;
    this.primaryTermSupplier = primaryTermSupplier;
    this.tombstoneDocSupplier = tombstoneDocSupplier;
}
 
源代码8 项目: crate   文件: EngineConfig.java
/**
 * Return the policy to use when caching queries.
 */
public QueryCachingPolicy getQueryCachingPolicy() {
    return queryCachingPolicy;
}
 
源代码9 项目: crate   文件: DisabledQueryCache.java
@Override
public Weight doCache(Weight weight, QueryCachingPolicy policy) {
    return weight;
}
 
源代码10 项目: crate   文件: IndexQueryCache.java
@Override
public Weight doCache(Weight weight, QueryCachingPolicy policy) {
    return indicesQueryCache.doCache(weight, policy);
}
 
 类所在包
 同包方法