|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectQueryRewriter
public abstract class QueryRewriter
Utility class for performing external rewriting, or transformation, tasks on Lucene queries. The base class simply provides a framework. Derived classes should override methods for those parts of a query they need to rewrite, and the base will take care of gluing them together properly.
Nested Class Summary | |
---|---|
static interface |
QueryRewriter.SpanClauseJoiner
Utility class that joins clauses into an Or query, And query, etc. |
Constructor Summary | |
---|---|
QueryRewriter()
|
Method Summary | |
---|---|
protected Query |
combineBoost(Query oldQuery,
Query newQuery)
Combines the boost value from an old query with that of a newly created one. |
protected Query |
copyBoost(Query oldQuery,
Query newQuery)
Copies the boost value from an old query to a newly created one. |
protected Query |
copyBoost(Query oldQuery1,
Query oldQuery2,
Query newQuery)
Copies the max boost value from two old queries to a newly created one. |
boolean |
forceRewrite(Query q)
Can be used to force some or all queries to be rewritten even if no changes. |
protected Query |
rewrite(BooleanQuery bq)
Rewrite a BooleanQuery. |
protected Query |
rewrite(SpanChunkedNotQuery nq)
Rewrite a span-based NOT query. |
protected Query |
rewrite(SpanDechunkingQuery nq)
Rewrite a span dechunking query. |
protected Query |
rewrite(SpanNearQuery q)
Rewrite a span NEAR query. |
protected Query |
rewrite(SpanNotNearQuery nq)
Rewrite a span-based NOT query. |
protected Query |
rewrite(SpanNotQuery nq)
Rewrite a span-based NOT query. |
protected Query |
rewrite(SpanOrNearQuery q)
Rewrite a span OR-NEAR query. |
protected Query |
rewrite(SpanOrQuery q)
Rewrite a span-based OR query. |
protected Query |
rewrite(SpanRangeQuery q)
Rewrite a span range query. |
protected Query |
rewrite(SpanTermQuery q)
Rewrite a span term query. |
protected Query |
rewrite(SpanWildcardQuery q)
Rewrite a span wildcard query. |
protected Query |
rewrite(TermQuery q)
Rewrite a term query. |
protected Query |
rewriteClauses(Query oldQuery,
SpanQuery[] oldClauses,
boolean promoteSingle,
QueryRewriter.SpanClauseJoiner joiner)
Utility function that takes care of rewriting a series of span query clauses. |
Query |
rewriteQuery(Query q)
Rewrite a query of any supported type. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QueryRewriter()
Method Detail |
---|
public Query rewriteQuery(Query q)
q
- Query to rewrite
public boolean forceRewrite(Query q)
protected Query rewrite(BooleanQuery bq)
bq
- The query to rewrite
protected Query rewrite(SpanNearQuery q)
q
- The query to rewrite
protected Query rewrite(SpanOrNearQuery q)
q
- The query to rewrite
protected Query rewrite(SpanOrQuery q)
q
- The query to rewrite
protected Query rewrite(SpanChunkedNotQuery nq)
nq
- The query to rewrite
protected Query rewrite(SpanNotQuery nq)
nq
- The query to rewrite
protected Query rewrite(SpanNotNearQuery nq)
nq
- The query to rewrite
protected Query rewrite(SpanDechunkingQuery nq)
nq
- The query to rewrite
protected Query rewrite(TermQuery q)
q
- The query to rewrite
protected Query rewrite(SpanTermQuery q)
q
- The query to rewrite
protected Query rewrite(SpanWildcardQuery q)
q
- The query to rewrite
protected Query rewrite(SpanRangeQuery q)
q
- The query to rewrite
protected Query copyBoost(Query oldQuery, Query newQuery)
oldQuery
- Query to copy fromnewQuery
- Query to copy to
protected Query copyBoost(Query oldQuery1, Query oldQuery2, Query newQuery)
oldQuery1
- First query to copy fromoldQuery2
- Second query to copy fromnewQuery
- Query to copy to
protected Query combineBoost(Query oldQuery, Query newQuery)
oldQuery
- Query to combine fromnewQuery
- Query to combine to
protected Query rewriteClauses(Query oldQuery, SpanQuery[] oldClauses, boolean promoteSingle, QueryRewriter.SpanClauseJoiner joiner)
oldQuery
- Query being rewrittenoldClauses
- Clauses to rewritepromoteSingle
- true to allow single-clause result to be returned,
false to force wrapping.joiner
- Handles joining new clauses into wrapper query
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |