org.elassandra.index.search.TokenRangesDirectoryReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elasticsearch Show documentation
Show all versions of elasticsearch Show documentation
Elasticsearch subproject :server
package org.elassandra.index.search;
import java.io.IOException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.FilterDirectoryReader;
import org.apache.lucene.index.LeafReader;
import org.apache.lucene.index.IndexReader.CacheHelper;
import org.apache.lucene.search.Query;
public class TokenRangesDirectoryReader extends FilterDirectoryReader {
final Query query;
final TokenRangesBitsetFilterCache cache;
public TokenRangesDirectoryReader(DirectoryReader in, Query query, TokenRangesBitsetFilterCache cache) throws IOException {
super(in, new FilterDirectoryReader.SubReaderWrapper() {
@Override
public LeafReader wrap(LeafReader reader) {
try {
return new TokenRangesLeafReader(in, reader, query, cache);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});
this.query = query;
this.cache = cache;
assert !(in instanceof TokenRangesDirectoryReader);
}
@Override
protected DirectoryReader doWrapDirectoryReader(DirectoryReader in) throws IOException {
return new TokenRangesDirectoryReader(in, query, cache);
}
@Override
public CacheHelper getReaderCacheHelper() {
// safe to delegate since this reader does not alter the index
return in.getReaderCacheHelper();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy