it.unimi.di.mg4j.query.nodes
Class AbstractTermExpander

java.lang.Object
  extended by it.unimi.di.mg4j.query.nodes.AbstractTermExpander
All Implemented Interfaces:
QueryTransformer
Direct Known Subclasses:
MultiIndexTermExpander

public abstract class AbstractTermExpander
extends Object
implements QueryTransformer

A query transformer that just requires implementing a method that expands terms (e.g., into disjunctive queries).

To implement more sophisticated behaviours, you can subclass the internal class AbstractTermExpander.ExpanderVisitor, and override the method expanderVisitor() so that it returns a (possibly cached) instance of your own visitor class (see, for an example, MultiIndexTermExpander).


Nested Class Summary
protected  class AbstractTermExpander.ExpanderVisitor
           
 
Constructor Summary
AbstractTermExpander()
           
 
Method Summary
abstract  Query expand(Prefix prefix)
          Expands a prefix.
abstract  Query expand(Term term)
          Expands a single term.
protected  AbstractTermExpander.ExpanderVisitor expanderVisitor()
          Returns a new expander visitor.
 Query transform(Query query)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTermExpander

public AbstractTermExpander()
Method Detail

expanderVisitor

protected AbstractTermExpander.ExpanderVisitor expanderVisitor()
Returns a new expander visitor.

Returns:
a visitor performing the expansion.

transform

public Query transform(Query query)
Specified by:
transform in interface QueryTransformer

expand

public abstract Query expand(Term term)
Expands a single term.

Parameters:
term - a term to be expanded.
Returns:
the resulting query.

expand

public abstract Query expand(Prefix prefix)
Expands a prefix.

Parameters:
prefix - the prefix to be expanded.
Returns:
the resulting query.