Java Code Examples for org.apache.lucene.index.SlowCompositeReaderWrapper#wrap()

The following examples show how to use org.apache.lucene.index.SlowCompositeReaderWrapper#wrap() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
 * @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 =;
  this.leafReader = SlowCompositeReaderWrapper.wrap(compositeReader);
  this.flagConfig = flagConfig;
  if (!flagConfig.stoplistfile().isEmpty())

  if (!flagConfig.startlistfile().isEmpty())
    loadStartWords(flagConfig.startlistfile());"Initialized LuceneUtils from Lucene index in directory: " + flagConfig.luceneindexpath() + "\n");"Fields in index are: " + String.join(", ", this.getFieldNames()) + "\n");
Example 2
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);
  return SlowCompositeReaderWrapper.wrap(;
Example 3
Source Project: incubator-retired-blur   File:    License: Apache License 2.0 4 votes vote down vote up
public static AtomicReader getAtomicReader(IndexReader reader) throws IOException {
  return SlowCompositeReaderWrapper.wrap(reader);