slow-J commented on issue #15845:
URL: https://github.com/apache/lucene/issues/15845#issuecomment-4651362151

   Getting a specific term's docFreq means calling `seekExact`, and I think 
[`testCreateWeightDoesNotSeekIfScoresAreNotNeeded`](https://github.com/apache/lucene/blob/9f30c435ad0d9b367b653f3304de262444f977d4/lucene/core/src/test/org/apache/lucene/search/TestTermQuery.java#L67)
 asserts createWeight does not do this when scores aren't needed.
   
   Also TermQuery has a `simScorer` while MatchAllDocsQuery has a 
`ConstantScoreWeight`. `rewrite()` doesnt see the `ScoreMode`, so rewriting 
TermQuery -> MatchAllDocsQuery is only safe where scores are not needed.
   
   I think we should do this in `ConstantScoreQuery#rewrite` instead of 
TermQuery. WDYT Mike?


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