Hi Jean, One thing I could come up with is to use IntervalQuery. Specifically you could create an IntervalQuery with IntervalSource of:
Intervals.within(Intervals.term(word2), 3, Intervals.term(word1))) to search for word2 that appears within 3 positions of word1 Best Patrick Jean Morissette <jean.morisse...@gmail.com> 于2021年3月31日周三 下午9:00写道: > Does someone know how to create a query for searching 2 words separated by > 0, 1, 2 or 3 gaps? > > Thanks >