Class TermVectors

  • Direct Known Subclasses:
    TermVectorsReader

    public abstract class TermVectors
    extends Object
    API for reading term vectors.

    NOTE: This class is not thread-safe and should only be consumed in the thread where it was acquired.

    • Field Detail

      • EMPTY

        public static final TermVectors EMPTY
        Instance that never returns term vectors
    • Constructor Detail

      • TermVectors

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

      • get

        public abstract Fields get​(int doc)
                            throws IOException
        Returns term vectors for this document, or null if term vectors were not indexed.

        The returned Fields instance acts like a single-document inverted index (the docID will be 0). If offsets are available they are in an OffsetAttribute available from the PostingsEnum.

        Throws:
        IOException
      • get

        public final Terms get​(int doc,
                               String field)
                        throws IOException
        Retrieve term vector for this document and field, or null if term vectors were not indexed.

        The returned Terms instance acts like a single-document inverted index (the docID will be 0). If offsets are available they are in an OffsetAttribute available from the PostingsEnum.

        Throws:
        IOException