[ https://issues.apache.org/jira/browse/LUCENE-2868?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon Willnauer updated LUCENE-2868: ------------------------------------ Attachment: query-rewriter.patch I just sketched out what I have in mind could solve this problem and create the infrastructure to do way more than just caching a query#rewrite. This patch (which is just a sketch to show what I have in mind) adds a QueryRewriter class that walks the Query "AST" and rewrites each query "node" in the tree. The default implementation does nothing special, it just forwards to the queryies rewrite method but there seems to be a whole lot of potential in such a tree-walker / visitor. For instance could we subclass it to optimize certain queries if we fix the coord problem. Yet another usecase is to decouple MTQ rewriter entirely from MTQ (not sure if we want that though) or somebody wants to wrap a query during rewrite. Even further somebody could rewrite against fieldcache? Maybe this can be even more general and just be a QueryVisitor so folks can easily walk the tree. I think this is really something that should be solved in general AND in a different issue. simon > 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 > Attachments: query-rewriter.patch > > > 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-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org