org.cdlib.xtf.textEngine
Class UnspanningQueryRewriter
Object
QueryRewriter
XtfQueryRewriter
UnspanningQueryRewriter
public class UnspanningQueryRewriter
- extends XtfQueryRewriter
This class converts some common span queries to their faster,
non-span equivalents.
- Author:
- Martin Haye
Method Summary |
protected Query |
rewrite(SpanOrQuery oq)
Replace span OR queries with more efficient plain OR, unless the parent
query is another span query. |
protected Query |
rewrite(SpanTermQuery q)
Replace span term queries, if they're not children of another span
query, with normal term queries. |
Query |
rewriteQuery(Query q)
Rewrite a query of any supported type. |
private boolean |
suppressRewrite()
For span queries with children, we don't want to un-span those children
because the span queries would then break. |
Methods inherited from class QueryRewriter |
combineBoost, copyBoost, copyBoost, forceRewrite, rewrite, rewrite, rewrite, rewrite, rewrite, rewrite, rewrite, rewrite, rewrite, rewrite, rewriteClauses |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
parentStack
private Stack parentStack
UnspanningQueryRewriter
public UnspanningQueryRewriter()
rewriteQuery
public Query rewriteQuery(Query q)
- Description copied from class:
XtfQueryRewriter
- Rewrite a query of any supported type.
- Overrides:
rewriteQuery
in class XtfQueryRewriter
- Parameters:
q
- Query to rewrite
- Returns:
- A new query, or 'q' unchanged if no change was needed.
suppressRewrite
private boolean suppressRewrite()
- For span queries with children, we don't want to un-span those children
because the span queries would then break.
rewrite
protected Query rewrite(SpanTermQuery q)
- Replace span term queries, if they're not children of another span
query, with normal term queries.
- Overrides:
rewrite
in class QueryRewriter
- Parameters:
q
- The query to rewrite
- Returns:
- Rewritten version, or 'q' unchanged if no changed needed.
rewrite
protected Query rewrite(SpanOrQuery oq)
- Replace span OR queries with more efficient plain OR, unless the parent
query is another span query.
- Overrides:
rewrite
in class QueryRewriter
- Parameters:
oq
- The query to rewrite
- Returns:
- Rewritten version, or 'oq' unchanged if no changed needed.