You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Karl Wright (JIRA)" <ji...@apache.org> on 2011/01/14 14:06:46 UTC

[jira] Commented: (LUCENE-2868) It should be easy to make use of TermState; rewritten queries should be shared automatically

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

Karl Wright commented on LUCENE-2868:
-------------------------------------

I reworded the description.

I think the word "cache" is correct, but what we really need is simply a cache that has the lifetime of a top-level rewrite.  I agree that putting the data in the query object itself would not have this characteristic, but on the other hand a second Query method that is cache aware seems reasonable.  For example:

Query rewriteMinimal(RewriteCache rc, IndexReader ir)

... where RewriteCache was an object that had a lifetime consistent with the highest-level rewrite operation done on the query graph.  The rewriteMinimal() method would look for the rewrite of the the current query in the RewriteCache, and if found, would return that, otherwise would call plain old rewrite() and then save the result.

So the patch would include:
(a) the change as specified to Query.java
(b) an implementation of RewriteCache, which *could* just be simplified to Map<Query,Query>
(c) changes to the callers of rewrite(), so that the minimal rewrite was called instead.

Thoughts?


> It should be easy to make use of TermState; rewritten queries should be shared automatically
> --------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-2868
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2868
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Query/Scoring
>            Reporter: Karl Wright
>
> When you have the same query in a query hierarchy multiple times, tremendous savings can now be had if the user knows enough to share the rewritten queries in the hierarchy, due to the TermState addition.  But this is clumsy and requires a lot of coding by the user to take advantage of.  Lucene should be smart enough to share the rewritten queries automatically.
> This can be most readily (and powerfully) done by introducing a new method to Query.java:
> Query rewriteUsingCache(IndexReader indexReader)
> ... and including a caching implementation right in Query.java which would then work for all.  Of course, all callers would want to use this new method rather than the current rewrite().

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org