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)
      Creates a new StoredFieldLoader
      Parameters:
      loadSource - should this loader load the _source field
      fields - a set of additional fields the loader should load
    • 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