Shahryar
Shahryar

Reputation: 1474

Rewrite query in lucene

When lucene want to compute weight of query it first call searcher.rewrite(Query),what does this function do for each types of query?

Upvotes: 3

Views: 1649

Answers (1)

skaffman
skaffman

Reputation: 403501

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.

Upvotes: 4

Related Questions