zhaih commented on code in PR #12197:
URL: https://github.com/apache/lucene/pull/12197#discussion_r1133053092


##########
lucene/core/src/java/org/apache/lucene/search/Query.java:
##########
@@ -77,10 +85,28 @@ public Weight createWeight(IndexSearcher searcher, 
ScoreMode scoreMode, float bo
    * <p>Callers are expected to call <code>rewrite</code> multiple times if 
necessary, until the
    * rewritten query is the same as the original query.
    *
+   * @deprecated Use {@link Query#rewrite(IndexSearcher)}
    * @see IndexSearcher#rewrite(Query)
    */
+  @Deprecated
   public Query rewrite(IndexReader reader) throws IOException {
-    return this;
+    return isDeprecatedRewriteMethodOverridden ? this : rewrite(new 
IndexSearcher(reader));

Review Comment:
   So if the user has `boolean->wrapper->knn` queries nested while the 
`wrapper` query has not overrided the new rewrite method then the knn query 
won't get the executor?
   If so should we add some warning about that (in the javadoc below)? Like 
"you have to make sure all parent queries have overrided rewrite(IndexSearcher) 
method to leverage potential parallelism" (or some better warning, sorry about 
my bad English)?



##########
lucene/CHANGES.txt:
##########
@@ -20,6 +20,9 @@ API Changes
 
 * GITHUB#11746: Deprecate LongValueFacetCounts#getTopChildrenSortByCount. 
(Greg Miller)
 
+* GITHUB#11840: Query rewrite now takes an IndexSearcher instead of 
IndexReader to enable concurrent
+  rewriting. (Patrick Zhai)

Review Comment:
   Please feel free to add yourself as co-author, the backport work is quite 
hard!



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