当前位置: 首页>>代码示例>>Java>>正文


Java Context.MERGE属性代码示例

本文整理汇总了Java中org.apache.lucene.store.IOContext.Context.MERGE属性的典型用法代码示例。如果您正苦于以下问题:Java Context.MERGE属性的具体用法?Java Context.MERGE怎么用?Java Context.MERGE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.lucene.store.IOContext.Context的用法示例。


在下文中一共展示了Context.MERGE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createOutput

@Override
public IndexOutput createOutput(String name, IOContext context) throws IOException {
    final IndexOutput output = in.createOutput(name, context);

    StoreRateLimiting rateLimiting = rateLimitingProvider.rateLimiting();
    StoreRateLimiting.Type type = rateLimiting.getType();
    RateLimiter limiter = rateLimiting.getRateLimiter();
    if (type == StoreRateLimiting.Type.NONE || limiter == null) {
        return output;
    }
    if (context.context == Context.MERGE || type == StoreRateLimiting.Type.ALL) {
        // we are merging, and type is either MERGE or ALL, rate limit...
        return new RateLimitedIndexOutput(new RateLimiterWrapper(limiter, rateListener), output);
    }
    // we shouldn't really get here...
    return output;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:RateLimitedFSDirectory.java

示例2: CompletionFieldsProducer

public CompletionFieldsProducer(SegmentReadState state) throws IOException {
    String suggestFSTFile = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, EXTENSION);
    IndexInput input = state.directory.openInput(suggestFSTFile, state.context);
    version = CodecUtil.checkHeader(input, CODEC_NAME, SUGGEST_CODEC_VERSION, SUGGEST_VERSION_CURRENT);
    FieldsProducer delegateProducer = null;
    boolean success = false;
    try {
        PostingsFormat delegatePostingsFormat = PostingsFormat.forName(input.readString());
        String providerName = input.readString();
        CompletionLookupProvider completionLookupProvider = providers.get(providerName);
        if (completionLookupProvider == null) {
            throw new IllegalStateException("no provider with name [" + providerName + "] registered");
        }
        // TODO: we could clone the ReadState and make it always forward IOContext.MERGE to prevent unecessary heap usage?
        delegateProducer = delegatePostingsFormat.fieldsProducer(state);
        /*
         * If we are merging we don't load the FSTs at all such that we
         * don't consume so much memory during merge
         */
        if (state.context.context != Context.MERGE) {
            // TODO: maybe we can do this in a fully lazy fashion based on some configuration
            // eventually we should have some kind of curciut breaker that prevents us from going OOM here
            // with some configuration
            this.lookupFactory = completionLookupProvider.load(input);
        } else {
            this.lookupFactory = null;
        }
        this.delegateProducer = delegateProducer;
        success = true;
    } finally {
        if (!success) {
            IOUtils.closeWhileHandlingException(delegateProducer, input);
        } else {
            IOUtils.close(input);
        }
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:37,代码来源:Completion090PostingsFormat.java

示例3: openInput

@Override
public IndexInput openInput(String name, IOContext context) throws IOException {
  ensureOpen();
  if (context.context != Context.MERGE || context.mergeInfo.estimatedMergeBytes < minBytesDirect || fileLength(name) < minBytesDirect) {
    return delegate.openInput(name, context);
  } else {
    return new NativeUnixIndexInput(new File(getDirectory(), name), mergeBufferSize);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:NativeUnixDirectory.java

示例4: createOutput

@Override
public IndexOutput createOutput(String name, IOContext context) throws IOException {
  ensureOpen();
  if (context.context != Context.MERGE || context.mergeInfo.estimatedMergeBytes < minBytesDirect) {
    return delegate.createOutput(name, context);
  } else {
    ensureCanWrite(name);
    return new NativeUnixIndexOutput(new File(getDirectory(), name), mergeBufferSize);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:10,代码来源:NativeUnixDirectory.java


注:本文中的org.apache.lucene.store.IOContext.Context.MERGE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。