public abstract class QueryRewriter
extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
QueryRewriter.SpanClauseJoiner
Utility class that joins clauses into an Or query, And query, etc.
|
Constructor and Description |
---|
QueryRewriter() |
Modifier and Type | Method and Description |
---|---|
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.
|
public Query rewriteQuery(Query q)
q
- Query to rewritepublic boolean forceRewrite(Query q)
protected Query rewrite(BooleanQuery bq)
bq
- The query to rewriteprotected Query rewrite(SpanNearQuery q)
q
- The query to rewriteprotected Query rewrite(SpanOrNearQuery q)
q
- The query to rewriteprotected Query rewrite(SpanOrQuery q)
q
- The query to rewriteprotected Query rewrite(SpanChunkedNotQuery nq)
nq
- The query to rewriteprotected Query rewrite(SpanNotQuery nq)
nq
- The query to rewriteprotected Query rewrite(SpanNotNearQuery nq)
nq
- The query to rewriteprotected Query rewrite(SpanDechunkingQuery nq)
nq
- The query to rewriteprotected Query rewrite(TermQuery q)
q
- The query to rewriteprotected Query rewrite(SpanTermQuery q)
q
- The query to rewriteprotected Query rewrite(SpanWildcardQuery q)
q
- The query to rewriteprotected Query rewrite(SpanRangeQuery q)
q
- The query to rewriteprotected Query copyBoost(Query oldQuery, Query newQuery)
oldQuery
- Query to copy fromnewQuery
- Query to copy toprotected Query copyBoost(Query oldQuery1, Query oldQuery2, Query newQuery)
oldQuery1
- First query to copy fromoldQuery2
- Second query to copy fromnewQuery
- Query to copy toprotected Query combineBoost(Query oldQuery, Query newQuery)
oldQuery
- Query to combine fromnewQuery
- Query to combine toprotected 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