Module org.elasticsearch.server
Class StoredFieldLoader
java.lang.Object
org.elasticsearch.index.fieldvisitor.StoredFieldLoader
Generates a
LeafStoredFieldLoader for a given lucene segment to load stored fields.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StoredFieldLoaderstatic StoredFieldLoaderCreates a new StoredFieldLoaderstatic StoredFieldLoaderempty()Creates a no-op StoredFieldLoader that will not load any fields from diskstatic StoredFieldLoaderfromSpec(StoredFieldsSpec spec) Creates a new StoredFieldLoader using a StoredFieldsSpecstatic StoredFieldLoaderCreates a new StoredFieldLoader using a StoredFieldsSpec that is optimized for loading documents in order.abstract LeafStoredFieldLoadergetLoader(org.apache.lucene.index.LeafReaderContext ctx, int[] docs) Return aLeafStoredFieldLoaderfor the given segment and document set The loader will use an internal lucene merge reader if the document set is of sufficient size and is contiguous.protected static CheckedBiConsumer<Integer, org.apache.lucene.index.StoredFieldVisitor, IOException> reader(org.apache.lucene.index.LeafReaderContext ctx, int[] docs) protected static CheckedBiConsumer<Integer, org.apache.lucene.index.StoredFieldVisitor, IOException> sequentialReader(org.apache.lucene.index.LeafReaderContext ctx) static StoredFieldLoaderCreates a StoredFieldLoader tuned for sequential reads of _source
-
Constructor Details
-
StoredFieldLoader
public StoredFieldLoader()
-
-
Method Details
-
getLoader
public abstract LeafStoredFieldLoader getLoader(org.apache.lucene.index.LeafReaderContext ctx, int[] docs) throws IOException Return aLeafStoredFieldLoaderfor the given segment and document set The loader will use an internal lucene merge reader if the document set is of sufficient size and is contiguous. Callers may passnullif the set is not known up front or if the merge reader optimisation will not apply.- Throws:
IOException
-
fieldsToLoad
- Returns:
- a list of fields that will be loaded for each document
-
fromSpec
Creates a new StoredFieldLoader using a StoredFieldsSpec -
fromSpecSequential
Creates a new StoredFieldLoader using a StoredFieldsSpec that is optimized for loading documents in order. -
create
-
create
public static StoredFieldLoader create(boolean loadSource, Set<String> fields, boolean forceSequentialReader) Creates a new StoredFieldLoader- Parameters:
loadSource- indicates whether this loader should load the_sourcefield.fields- a set of additional fields that the loader should load.forceSequentialReader- iftrue, forces the use of a sequential leaf reader; otherwise, uses the heuristic defined inreader(LeafReaderContext, int[]).
-
sequentialSource
Creates a StoredFieldLoader tuned for sequential reads of _source -
empty
Creates a no-op StoredFieldLoader that will not load any fields from disk -
reader
protected static CheckedBiConsumer<Integer,org.apache.lucene.index.StoredFieldVisitor, readerIOException> (org.apache.lucene.index.LeafReaderContext ctx, int[] docs) throws IOException - Throws:
IOException
-
sequentialReader
protected static CheckedBiConsumer<Integer,org.apache.lucene.index.StoredFieldVisitor, sequentialReaderIOException> (org.apache.lucene.index.LeafReaderContext ctx) throws IOException - Throws:
IOException
-