类org.apache.lucene.index.SlowCompositeReaderWrapper源码实例Demo

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

源代码1 项目: semanticvectors   文件: LuceneUtils.java
/**
 * @param flagConfig Contains all information necessary for configuring LuceneUtils.
 *        {@link FlagConfig#luceneindexpath()} must be non-empty. 
 */
public LuceneUtils(FlagConfig flagConfig) throws IOException {
  if (flagConfig.luceneindexpath().isEmpty()) {
    throw new IllegalArgumentException(
        "-luceneindexpath is a required argument for initializing LuceneUtils instance.");
  }

  this.compositeReader = DirectoryReader.open(
      FSDirectory.open(FileSystems.getDefault().getPath(flagConfig.luceneindexpath())));
  this.leafReader = SlowCompositeReaderWrapper.wrap(compositeReader);
  MultiFields.getFields(compositeReader);
  this.flagConfig = flagConfig;
  if (!flagConfig.stoplistfile().isEmpty())
    loadStopWords(flagConfig.stoplistfile());

  if (!flagConfig.startlistfile().isEmpty())
    loadStartWords(flagConfig.startlistfile());

  VerbatimLogger.info("Initialized LuceneUtils from Lucene index in directory: " + flagConfig.luceneindexpath() + "\n");
  VerbatimLogger.info("Fields in index are: " + String.join(", ", this.getFieldNames()) + "\n");
}
 
private AtomicReader createIndexReader() throws IOException {
  RAMDirectory directory = new RAMDirectory();
  IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(LUCENE_VERSION, new StandardAnalyzer(LUCENE_VERSION)));
  for (int i = 0; i < BLOCKS; i++) {
    addDocumentBlock(i, COUNT_PER_BLOCK, writer);
  }
  writer.close();
  return SlowCompositeReaderWrapper.wrap(DirectoryReader.open(directory));
}
 
源代码3 项目: incubator-retired-blur   文件: BlurUtil.java
public static AtomicReader getAtomicReader(IndexReader reader) throws IOException {
  return SlowCompositeReaderWrapper.wrap(reader);
}
 
 类所在包
 类方法
 同包方法