Class DifferenceDocumentIterator

  • All Implemented Interfaces:
    DocumentIterator

    public class DifferenceDocumentIterator
    extends AbstractIntervalDocumentIterator
    implements DocumentIterator
    A document iterator that computes the Brouwerian difference between two given document iterators.

    In the lattice of interval antichains, the Brouwerian difference is obtained by deleting from the first operand (the minuend) all intervals that contain some interval of the second operand (the subtrahend). Thus, Brouwerian difference can be fruitfully employed to kill intervals containing a term or, even more fruitfully, to change at query time the granularity of an index by subtracting from the results of a query those length-two intervals that cross the cutpoints between the desired parts of the index.

    Additionally, this class provides interval enlargement—by using a suitable factory method each interval returned by the subtrahend will be enlarged to the left and to the right by the given amount (e.g., if the left margin is 1 and the right margin is 2 the interval [2..3] will turn into [1..5]).

    Note that while accept(DocumentIteratorVisitor) will recursively visit both the minuend and the subtrahend, acceptOnTruePaths(DocumentIteratorVisitor) will visit only the minuend.

    Since:
    1.2
    Author:
    Sebastiano Vigna