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

Alan Woodward commented on LUCENE-6561:
---------------------------------------

bq. I don't think we should even encourage caching of this?

Well at the moment we don't even make caching possible - TermContext.build() is 
a static method, so there's no way to do what Mike suggests and build an 
external cache.  I agree that IndexSearcher is the wrong place to expose it 
though.  And a package-private method wouldn't work, because SpanTermQuery is 
in a different package.

The concurrency problems arise because of sharing the cache between multiple 
queries, maybe what's really needed is a QueryContext that's passed to 
createWeight() that holds this kind of info?

> Add a TermContextCache to IndexSearcher
> ---------------------------------------
>
>                 Key: LUCENE-6561
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6561
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Alan Woodward
>         Attachments: LUCENE-6561.patch, LUCENE-6561.patch
>
>
> TermContexts can be quite expensive to build, and if you have fairly complex 
> queries that re-use the same terms you can end up spending a lot of time 
> re-building the same ones over and over again.  It would be nice to be able 
> to cache them on an IndexSearcher, so that they can be re-used.



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