Example usage for org.apache.lucene.index LeafReader getCoreCacheHelper

List of usage examples for org.apache.lucene.index LeafReader getCoreCacheHelper

Introduction

In this page you can find the example usage for org.apache.lucene.index LeafReader getCoreCacheHelper.

Prototype

public abstract CacheHelper getCoreCacheHelper();

Source Link

Document

Optional method: Return a IndexReader.CacheHelper that can be used to cache based on the content of this leaf regardless of deletions.

Usage

From source file:org.elasticsearch.common.lucene.uid.PerThreadIDVersionAndSeqNoLookup.java

License:Apache License

/**
 * Initialize lookup for the provided segment
 *//*from w  ww .j a v a  2s.  c o  m*/
PerThreadIDVersionAndSeqNoLookup(LeafReader reader, String uidField) throws IOException {
    this.uidField = uidField;
    Terms terms = reader.terms(uidField);
    if (terms == null) {
        throw new IllegalArgumentException("reader misses the [" + uidField + "] field");
    }
    termsEnum = terms.iterator();
    if (reader.getNumericDocValues(VersionFieldMapper.NAME) == null) {
        throw new IllegalArgumentException("reader misses the [" + VersionFieldMapper.NAME + "] field");
    }

    Object readerKey = null;
    assert (readerKey = reader.getCoreCacheHelper().getKey()) != null;
    this.readerKey = readerKey;
}