shubhamvishu opened a new pull request, #13950:
URL: https://github.com/apache/lucene/pull/13950

   ### Description
   
   Changes in this PR :
   
   1. Makes some `BooleanQuery` methods that seem useful to user public. Like 
the `getClauses(Occur occur` to get the collection of one type of clauses. 
Without public I had to call `getClauses` and iterate to store this info 
whereas `BoolenQuery` is [already storing this info in 
clauseSets](https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java#L111)
 which seems like a good candidate to be exposed for reuse. This would also 
simplify not having checks like eg: 
[1](https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java#L366-L370),
 
[2](https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java#L461-L465),
 
[3](https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java#L530-L532),
 
[4](https://github.com/apache/lucene/blob/main/lucene/monitor/src/java/org/apache/lucene/monitor/QueryAnalyzer.j
 ava#L86-L87) etc along with the `add(Collection)` method(point 3 below). 
   2. Similarly make `#isPureDisjunction` and 
`isTwoClausePureDisjunctionWithTerms` public which looks could be something 
useful to be exposed by the `BooleanQuery` class to me.
   3. Adds an `add(Collection<BooleanClause> collection)` method to 
`BooleanQuery.Builder`. While doing some query manipulation I had to insert a 
set of clause but one by one. I'd be useful if there was a 
`add(Collection<BooleanClause> collection)` to add the to the maintained list 
of clauses and simplify it for cases where users are manipulating the BQ. I see 
some places in code that could be refactored to avoid looping to insert the 
list of clauses as mentioned in point 1.
   
   I'd love to hear thoughts and suggestions. I don't know if there are any 
rationale of not having these methods public earlier(or a previous attempt) but 
would love to know.
   
   <!--
   If this is your first contribution to Lucene, please make sure you have 
reviewed the contribution guide.
   https://github.com/apache/lucene/blob/main/CONTRIBUTING.md
   -->
   


-- 
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

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