[ 
https://issues.apache.org/jira/browse/LUCENE-8612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16723044#comment-16723044
 ] 

Alan Woodward commented on LUCENE-8612:
---------------------------------------

Here is a patch adding {{Intervals.extend(source, before, after)}}, which 
allows you to make an interval cover extra positions before and after the 
actual terms.  To search for {{a [space] b [space] c}}, for example, you could 
call {{Intervals.phrase(Intervals.term("a"), 
Intervals.extend(Intervals.term("b", 1, 1)), Intervals.term("c")}}

The patch also clarifies the javadocs for how IntervalIterator should report 
start() and end() after the interval has been exhausted for the current 
document (important for the unordered algorithm), and fixes IntervalMatches to 
report start and end positions from its underlying IntervalIterator, rather 
than any wrapped Matches - for most iterators they are the same, but for 
ExtendedIntervalIterator we need to report the extended bounds so that phrase 
queries will still correctly report matches.

> Add the ability to enforce gaps between intervals
> -------------------------------------------------
>
>                 Key: LUCENE-8612
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8612
>             Project: Lucene - Core
>          Issue Type: Task
>            Reporter: Alan Woodward
>            Assignee: Alan Woodward
>            Priority: Major
>         Attachments: LUCENE-8612.patch
>
>
> At the moment you can search for intervals with a maximum number of positions 
> between them, but you cannot enforce gaps.  It would be useful to be able to 
> search for `a b [2 spaces] c`.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to