[ https://issues.apache.org/jira/browse/LUCENE-6639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14608281#comment-14608281 ]
Terry Smith commented on LUCENE-6639: ------------------------------------- This doesn't seem pressing but irked me enough to submit a ticket. It feels that we should be able to be more correct but the current API isn't very supportive of that work flow. I slightly prefer calling onUse() from createWeight() as it does make this edge case of the first segment go away which I feel is harder to reason about than someone creating a weight and not using it. The improved multi-threaded search code in IndexSearcher is a great example of this misbehaving where there is no guarantee that the first segment's Weight.scorer() will be called before the other segments. However I'm not familiar with use cases that use Query.createWeight() without executing some kind of search or explain to know if they are more of an issue. Is adding bookend methods to more correctly detect the begin/end of the search phase seen as too messy and special casey? At the end of the day I also wonder if it's worth the complexity but wanted to open this ticket to bootstrap the discussion as this could be a hard problem to diagnose in the future (someone wants to know why their query isn't getting cached and it's due to some obscure detail like this). > LRUQueryCache.CachingWrapperWeight not calling policy.onUse() if the first > scorer is skipped > -------------------------------------------------------------------------------------------- > > Key: LUCENE-6639 > URL: https://issues.apache.org/jira/browse/LUCENE-6639 > Project: Lucene - Core > Issue Type: Bug > Affects Versions: 5.3 > Reporter: Terry Smith > Priority: Minor > Attachments: LUCENE-6639.patch > > > The method > {{org.apache.lucene.search.LRUQueryCache.CachingWrapperWeight.scorer(LeafReaderContext)}} > starts with > {code} > if (context.ord == 0) { > policy.onUse(getQuery()); > } > {code} > which can result in a missed call for queries that return a null scorer for > the first segment. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org