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

Terry Smith commented on LUCENE-6661:
-------------------------------------

I'd completely missed the issue with marker interfaces, this really ought to be 
a method on Weight itself, perhaps Weight.cacheCompatible().

You suggested workaround sounds a little special casey. I'd be concerned that a 
future release something would change in such a way that the workaround would 
be lost with no alternative. Specifically, it relies on the cache 
implementation tracking usage when the cache itself is pluggable (it could be 
replaced with one that does not) and when LRUQueryCache itself in play I see 
the following issues:

1) The queries that we know ahead of time should never be cached would still 
take up room in the ring buffer and thus push aside other less frequent queries 
that could be great cache candidates.

2)  Special care would want to be taken over the Query instances used in the 
ring buffer and cache so that things like dependent FacetCollectors don't get 
added and bloat memory usage. You described earlier how to handle this from 
createWeight().

3) CachingWrapperWeight forces the cached query to use scorer() instead of 
bulkScorer(). Both my custom query and DrillSidewaysQuery implement a custom 
bulkScorer() method and throw an UnsupportedOperationException from scorer(). 
They break when wrapped in a CachingWraperWeight. The ability to opt of of 
caching would remove the need for the hacky workaround in DrillSideways.

My current solution is a custom QueryCache implementation that just delegates 
to the LRUQueryCache and does not propagate doCache() for some Weights. 
However, this has the same problem with wrapped queries as the marker interface 
scenario.





> Allow queries to opt out of caching
> -----------------------------------
>
>                 Key: LUCENE-6661
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6661
>             Project: Lucene - Core
>          Issue Type: Improvement
>    Affects Versions: 5.2
>            Reporter: Terry Smith
>            Priority: Minor
>         Attachments: LUCENE-6661.patch
>
>
> Some queries have out-of-band dependencies that make them incompatible with 
> caching, it'd be great if they could opt out of the new fancy query/filter 
> cache in IndexSearcher.
> This affects DrillSidewaysQuery and any user-provided custom Query 
> implementations.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to