Class Fields

All Implemented Interfaces:
Direct Known Subclasses:
FieldsProducer, FilterLeafReader.FilterFields, MultiFields

public abstract class Fields extends Object implements Iterable<String>
Provides a Terms index for fields that have it, and lists which fields do. This is primarily an internal/experimental API (see FieldsProducer), although it is also used to expose the set of term vectors per document.
WARNING: This API is experimental and might change in incompatible ways in the next release.
  • Field Details


      public static final Fields[] EMPTY_ARRAY
      Zero-length Fields array.
  • Constructor Details

    • Fields

      protected Fields()
      Sole constructor. (For invocation by subclass constructors, typically implicit.)
  • Method Details

    • iterator

      public abstract Iterator<String> iterator()
      Returns an iterator that will step through all fields names. This will not return null.
      Specified by:
      iterator in interface Iterable<String>
    • terms

      public abstract Terms terms(String field) throws IOException
      Get the Terms for this field. This will return null if the field does not exist.
    • size

      public abstract int size()
      Returns the number of fields or -1 if the number of distinct field names is unknown. If >= 0, iterator() will return as many field names.