extend

fun extend(source: IntervalsSource, before: Int, after: Int): IntervalsSource

Create an IntervalsSource that wraps another source, extending its intervals by a number of positions before and after.

This can be useful for adding defined gaps in a block query; for example, to find 'a b [2 arbitrary terms] c', you can call:

Intervals.phrase(Intervals.term("a"), Intervals.extend(Intervals.term("b"), 0, 2), Intervals.term("c"));

Note that calling IntervalIterator.gaps on iterators returned by this source delegates directly to the wrapped iterator, and does not include the extensions.

Parameters

source

the source to extend

before

how many positions to extend before the delegated interval

after

how many positions to extend after the delegated interval