List of usage examples for org.apache.lucene.search IndexSearcher getTopReaderContext
public IndexReaderContext getTopReaderContext()
From source file:org.sindice.siren.search.node.NodeTermQuery.java
License:Apache License
@Override public Weight createWeight(final IndexSearcher searcher) throws IOException { final IndexReaderContext context = searcher.getTopReaderContext(); final TermContext termState; if (perReaderTermState == null || perReaderTermState.topReaderContext != context) { // make TermQuery single-pass if we don't have a PRTS or if the context differs! termState = TermContext.build(context, term, true); // cache term lookups! } else {/* w w w . j a v a2s.c o m*/ // PRTS was pre-build for this IS termState = this.perReaderTermState; } // we must not ignore the given docFreq - if set use the given value (lie) if (docFreq != -1) termState.setDocFreq(docFreq); return new NodeTermWeight(searcher, termState); }