When lucene want to compute weight of q开发者_开发技巧uery it first call searcher.rewrite(Query),what does this function do for each types of query?
The query rewriter turns higher-level query clauses into lower-level clauses that perform better. The end result is functionally identical.
For example, the javadoc for Query.rewrite
says:
Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
If Lucene is to perform an accurate query cost analysis, it needs to rewrite the query into its fastest form.
精彩评论