GovindBalaji-S-Glean opened a new pull request, #15441:
URL: https://github.com/apache/lucene/pull/15441

   ### Description
   Fixes https://github.com/apache/lucene/issues/14986.
   
   A `TermInSetQuery` with `rewriteMethod = 
MultiTermQuery.CONSTANT_SCORE_BLENDED_REWRITE` creates a `RewritingWeight`. 
Getting a scorer from this `RewritingWeight` for a segment could involve 
rewriting to a `BooleanQuery` of multiple `TermQuery` with only the terms 
present in that particular segment.
   
   These segment-specific `BooleanQuery` rewrites all thrash the 
`UsageTrackingQueryCachingPolicy` ring buffer, which is shared across all 
segments of the index. The expectation is that we mark a query only once per 
shard in this ring buffer - 
[ref](https://github.com/apache/lucene/blob/a3fa283cfd6aefbcc5a4983e065da0ce7d3209fe/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java#L686-L688)
   
   In this change: When initializing 
`AbstractMultiTermQueryConstantScoreWrapper.RewritingWeight`, we copy the 
supplied indexSearcher but with `setQueryCache(null)` and pass it along for the 
segment-specific rewrites. The subsequent rewrites into BooleanQuery of 
TermQuery don't go through the query cache (The idea is that these should be 
cached as the parent TermInSet query itself)
   <!--
   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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to