Class Spans

  • Direct Known Subclasses:
    FilterSpans, NearSpansOrdered, NearSpansUnordered, TermSpans

    public abstract class Spans
    extends DocIdSetIterator
    Iterates through combinations of start/end positions per-doc. Each start/end position represents a range of term positions within the current document. These are enumerated in order, by increasing document number, within that by increasing start position and finally by increasing end position.
    • Constructor Detail

      • Spans

        public Spans()
    • Method Detail

      • nextStartPosition

        public abstract int nextStartPosition()
                                       throws IOException
        Returns the next start position for the current doc. There is always at least one start/end position per doc. After the last start/end position at the current doc this returns NO_MORE_POSITIONS.
        Throws:
        IOException
      • startPosition

        public abstract int startPosition()
        Returns the start position in the current doc, or -1 when nextStartPosition() was not yet called on the current doc. After the last start/end position at the current doc this returns NO_MORE_POSITIONS.
      • endPosition

        public abstract int endPosition()
        Returns the end position for the current start position, or -1 when nextStartPosition() was not yet called on the current doc. After the last start/end position at the current doc this returns NO_MORE_POSITIONS.
      • width

        public abstract int width()
        Return the width of the match, which is typically used to sloppy freq. It is only legal to call this method when the iterator is on a valid doc ID and positioned. The return value must be positive, and lower values means that the match is better.
      • collect

        public abstract void collect​(SpanCollector collector)
                              throws IOException
        Collect postings data from the leaves of the current Spans. This method should only be called after nextStartPosition(), and before NO_MORE_POSITIONS has been reached.
        Parameters:
        collector - a SpanCollector
        Throws:
        IOException
        WARNING: This API is experimental and might change in incompatible ways in the next release.
      • positionsCost

        public abstract float positionsCost()
        Return an estimation of the cost of using the positions of this Spans for any single document, but only after asTwoPhaseIterator() returned null. Otherwise this method should not be called. The returned value is independent of the current document.
        WARNING: This API is experimental and might change in incompatible ways in the next release.
      • doStartCurrentDoc

        protected void doStartCurrentDoc()
                                  throws IOException
        Called before the current doc's frequency is calculated
        Throws:
        IOException
      • doCurrentSpans

        protected void doCurrentSpans()
                               throws IOException
        Called each time the scorer's SpanScorer is advanced during frequency calculation
        Throws:
        IOException