rmuir commented on issue #12026:
URL: https://github.com/apache/lucene/issues/12026#issuecomment-1360081092

   You are doing count queries that get implemented with Weight.count(). 
Separately, that's really strange, i dont know what you are doing, but that 
isn't very typical. e.g. if you are just counting occurrences of terms for some 
purpose, you maybe just want to call `docFreq`.
   
   The issue with preallocating exceptions is you lose the stack trace, not a 
good tradeoff. But it might be ok to preallocate one inside 
`TopHitCountCollector` where it early-terminates when `Weight.count` is 
supported for the segment... I'm not sure. I'd first want to know what the 
use-case is for doing thousands of count queries this way, as it isn't typical. 
If you are bottlenecked on cost of creating an exception then seems to me 
everything is impossibly fast for your app and there's nothing to worry about. 
I'm really not convinced the cost here is large.
   
   Please look at how the mechanism is used, it is not just something you 
change to an `Optional` or similar. For example a Scorer can early-terminate a 
segment from something like `nextDoc` which is the intended use-case.
   


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