org.cdlib.xtf.textEngine
Class RefieldingQueryRewriter

Object
  extended by QueryRewriter
      extended by XtfQueryRewriter
          extended by RefieldingQueryRewriter

public class RefieldingQueryRewriter
extends XtfQueryRewriter

This class swaps the current field of every sub-query to the specified field.

Author:
Martin Haye

Nested Class Summary
 
Nested classes/interfaces inherited from class QueryRewriter
QueryRewriter.SpanClauseJoiner
 
Field Summary
private  String newField
           
 
Constructor Summary
RefieldingQueryRewriter()
           
 
Method Summary
 Query refield(Query q, String field)
          Change the field name of the given query
protected  Query rewrite(NumericRangeQuery nrq)
          Rewrite a numeric range 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.
private  Term rewriteTerm(Term t)
          Switch the field of the given term
 
Methods inherited from class XtfQueryRewriter
rewrite, rewrite, rewrite, rewriteQuery
 
Methods inherited from class QueryRewriter
combineBoost, copyBoost, copyBoost, forceRewrite, 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
 

Field Detail

newField

private String newField
Constructor Detail

RefieldingQueryRewriter

public RefieldingQueryRewriter()
Method Detail

refield

public Query refield(Query q,
                     String field)
Change the field name of the given query


rewriteTerm

private Term rewriteTerm(Term t)
Switch the field of the given term


rewrite

protected Query rewrite(TermQuery q)
Description copied from class: QueryRewriter
Rewrite a term query. The base class does nothing.

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(SpanTermQuery q)
Description copied from class: QueryRewriter
Rewrite a span term query. The base class does nothing unless rewriting is forced.

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(SpanWildcardQuery q)
Description copied from class: QueryRewriter
Rewrite a span wildcard query. The base class does nothing unless rewriting is forced.

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(SpanRangeQuery q)
Description copied from class: QueryRewriter
Rewrite a span range query. The base class does nothing unless rewriting is forced.

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(NumericRangeQuery nrq)
Description copied from class: XtfQueryRewriter
Rewrite a numeric range query

Overrides:
rewrite in class XtfQueryRewriter