uschindler opened a new issue, #13388:
URL: https://github.com/apache/lucene/issues/13388

   ### Description
   
   Followup of #13385:
   
   While reviewing #13385 I stumbled on the same issue I had several times 
while building a intervals query parser for patent search (a Solr plugin for a 
customer). There is no way to get an IntervalsSource that matches no intervals, 
so it will make one clause of a complex IntervalQuery consisting of serveral 
clauses be a non-match. One example where I hit this: We expand wildcards and 
filter some terms from expanding (like adding a limit on number of terms or 
similar), but when trying to build an empty clause it's impossible.
   
   The easy "workaround" in Lucene/Solr 9.x is to use this class, which is 
unfortunately pkg private:
   
https://github.com/expani/lucene/blob/1ee4f8a1115d1de623f242014681032d87ed2c1e/lucene/queries/src/java/org/apache/lucene/queries/intervals/NoMatchIntervalsSource.java
   
   To get an instance there's a workaround, but its undocumented: public static 
IntervalsSource Intervals#atLeast(int minShouldMatch, IntervalsSource... 
sources). You can misuse it by passing 1 and an empty array: 
Intervals.atLeast(1)
   
   I wonder how this differs from `IntervalBuilder#NO_INTERVALS`, which was 
made public in #13385. The implementations of both classes differ: one returns 
an iterator, which is empty, the other one returns `null`.
   
   I'd suggest to merge those implementations and instead of exposing a 
constant to end user add another static method like Intervals#noMatch("reason").
   
   We should revert #13385 and prefer a method instead of a constant.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to