[ 
https://issues.apache.org/jira/browse/LUCENE-6639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14611649#comment-14611649
 ] 

Adrien Grand commented on LUCENE-6639:
--------------------------------------

One issue I have with putting the call in createWeight is that you might 
sometimes only pull a Weight in order to extract terms (eg. for highlighting or 
computing distributed term frequencies), so incrementing the counter here would 
not work.

That said, you made good arguments against the current logic. In particular 
it's true that reusing weights for multiple collections should not be common so 
maybe we can just call policy.onUse on the first time that Weight.scorer is 
called?

> 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

Reply via email to