Class StoredFieldLoader

java.lang.Object
org.elasticsearch.index.fieldvisitor.StoredFieldLoader

public abstract class StoredFieldLoader extends Object
Generates a LeafStoredFieldLoader for a given lucene segment to load stored fields.
  • Constructor Details

    • StoredFieldLoader

      public StoredFieldLoader()
  • Method Details

    • getLoader

      public abstract LeafStoredFieldLoader getLoader(org.apache.lucene.index.LeafReaderContext ctx, int[] docs) throws IOException
      Return a LeafStoredFieldLoader for 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 pass null if the set is not known up front or if the merge reader optimisation will not apply.
      Throws:
      IOException
    • fieldsToLoad

      public abstract List<String> fieldsToLoad()
      Returns:
      a list of fields that will be loaded for each document
    • fromSpec

      public static StoredFieldLoader fromSpec(StoredFieldsSpec spec)
      Creates a new StoredFieldLoader using a StoredFieldsSpec
    • create

      public static StoredFieldLoader create(boolean loadSource, Set<String> fields)
    • 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 _source field.
      fields - a set of additional fields that the loader should load.
      forceSequentialReader - if true, forces the use of a sequential leaf reader; otherwise, uses the heuristic defined in reader(LeafReaderContext, int[]).
    • fromSpecSequential

      public static StoredFieldLoader fromSpecSequential(StoredFieldsSpec spec)
      Creates a new StoredFieldLoader using a StoredFieldsSpec that is optimized for loading documents in order.
    • sequentialSource

      public static StoredFieldLoader sequentialSource()
      Creates a StoredFieldLoader tuned for sequential reads of _source
    • empty

      public static StoredFieldLoader empty()
      Creates a no-op StoredFieldLoader that will not load any fields from disk