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

Jim Ferenczi commented on LUCENE-8196:
--------------------------------------

I don't think we should prevent anything ;). *unordered* is a conjunction 
operator so it should match if all terms match (which is the case in your 
example) so these results are expected IMO. Maybe we should rename *unordered* 
to *and* in order to avoid confusion ?
If you want to match the same term within a max width the ordered query works 
fine:
{code:java}
Query q = new IntervalQuery(field, Intervals.maxwidth(2, 
Intervals.ordered(Intervals.term("w3"), Intervals.term("w3"))));
{code}

[~romseygeek] while I was playing with *unordered* I realized that we don't 
protect against sources that match but don't have intervals.
For instance:
{code:java}
Query q = new IntervalQuery(query, Intervals.unordered(Intervals.term("w2"), 
Intervals.ordered(Intervals.term("w3"),Intervals.term("w3"))));
{code}
does not work because the *unordered* query doesn't check if the sub source has 
intervals when it adds it in the queue. 
I attached a patch that fixes this issue and added some tests that fail without 
the fix. Can you take a look ?


> Add IntervalQuery and IntervalsSource to expose minimum interval semantics 
> across term fields
> ---------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-8196
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8196
>             Project: Lucene - Core
>          Issue Type: New Feature
>            Reporter: Alan Woodward
>            Assignee: Alan Woodward
>            Priority: Major
>             Fix For: 7.4
>
>         Attachments: LUCENE-8196.patch, LUCENE-8196.patch, LUCENE-8196.patch, 
> LUCENE-8196.patch, LUCENE-8196.patch
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> This ticket proposes an alternative implementation of the SpanQuery family 
> that uses minimum-interval semantics from 
> [http://vigna.di.unimi.it/ftp/papers/EfficientAlgorithmsMinimalIntervalSemantics.pdf]
>  to implement positional queries across term-based fields.  Rather than using 
> TermQueries to construct the interval operators, as in LUCENE-2878 or the 
> current Spans implementation, we instead use a new IntervalsSource object, 
> which will produce IntervalIterators over a particular segment and field.  
> These are constructed using various static helper methods, and can then be 
> passed to a new IntervalQuery which will return documents that contain one or 
> more intervals so defined.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to