org.mmbase.storage.search.implementation.database.informix.excalibur
Class EtxSqlHandler

java.lang.Object
  extended byorg.mmbase.storage.search.implementation.database.ChainedSqlHandler
      extended byorg.mmbase.storage.search.implementation.database.informix.excalibur.EtxSqlHandler
All Implemented Interfaces:
SqlHandler

public class EtxSqlHandler
extends ChainedSqlHandler
implements SqlHandler

The Etx query handler adds support for Excalibur Text Search constraints, when used with an Informix database and an Excalibur Text Search datablade. This class is provided as a coding example of a ChainedSqlHandler.

On initialization, the handler reads a list of etx-indices from a configuration file. This configurationfile must be named etxindices.xml and located inside the databases configuration directory. It's dtd is located in the directory org.mmbase.storage.search.implementation.database.informix.excalibur.resources in the MMBase source tree and here online.

Since:
MMBase-1.7
Version:
$Id: EtxSqlHandler.java,v 1.1 2003/12/23 11:03:04 robmaris Exp $
Author:
Rob van Maris

Constructor Summary
EtxSqlHandler(SqlHandler successor)
          Creates a new instance of EtxueryHandler.
 
Method Summary
 void appendConstraintToSql(java.lang.StringBuffer sb, Constraint constraint, SearchQuery query, boolean inverse, boolean inComposite)
          Represents Constraint object, that is not a CompositeConstraint, as a constraint in SQL format, appending the result to a stringbuffer.
protected  boolean containsOtherStringSearchConstraints(Constraint constraint, StringSearchConstraint searchConstraint)
          Tests if a constaint is/contains another stringsearch constraint than the specified one.
 int getSupportLevel(Constraint constraint, SearchQuery query)
          Gets the level at which a constraint is supported for a query by this handler.
 int getSupportLevel(int feature, SearchQuery query)
          Gets the level at which a feature is supported for a query by this handler.
protected  boolean hasAdditionalConstraints(SearchQuery query)
          Tests if the query contains additional constraints, i.e.
 boolean hasEtxIndex(StepField field)
          Tests if an Excelibur Text Search index has been made for this field.
 
Methods inherited from class org.mmbase.storage.search.implementation.database.ChainedSqlHandler
appendQueryBodyToSql, getAllowedValue, getSuccessor, toSql
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mmbase.storage.search.implementation.database.SqlHandler
appendQueryBodyToSql, getAllowedValue, toSql
 

Constructor Detail

EtxSqlHandler

public EtxSqlHandler(SqlHandler successor)
              throws java.io.IOException
Creates a new instance of EtxueryHandler.

Parameters:
successor - Successor in chain or responsibility.
Method Detail

appendConstraintToSql

public void appendConstraintToSql(java.lang.StringBuffer sb,
                                  Constraint constraint,
                                  SearchQuery query,
                                  boolean inverse,
                                  boolean inComposite)
                           throws SearchQueryException
Description copied from interface: SqlHandler
Represents Constraint object, that is not a CompositeConstraint, as a constraint in SQL format, appending the result to a stringbuffer. When it is part of a composite expression, it will be surrounded by parenthesis when needed.

Specified by:
appendConstraintToSql in interface SqlHandler
Overrides:
appendConstraintToSql in class ChainedSqlHandler
Throws:
SearchQueryException

getSupportLevel

public int getSupportLevel(int feature,
                           SearchQuery query)
                    throws SearchQueryException
Description copied from interface: SqlHandler
Gets the level at which a feature is supported for a query by this handler. This is one of either: Given the choice, the query handler with the highest level of support is prefered.

Specified by:
getSupportLevel in interface SqlHandler
Overrides:
getSupportLevel in class ChainedSqlHandler
Throws:
SearchQueryException

getSupportLevel

public int getSupportLevel(Constraint constraint,
                           SearchQuery query)
                    throws SearchQueryException
Description copied from interface: SqlHandler
Gets the level at which a constraint is supported for a query by this handler. This is one of either: Given the choice, the query handler with the highest level of support is prefered.

Specified by:
getSupportLevel in interface SqlHandler
Overrides:
getSupportLevel in class ChainedSqlHandler
Throws:
SearchQueryException

hasEtxIndex

public boolean hasEtxIndex(StepField field)
Tests if an Excelibur Text Search index has been made for this field.

Parameters:
field - the field.
Returns:
true if an Excelibur Text Search index has been made for this field, false otherwise.

hasAdditionalConstraints

protected boolean hasAdditionalConstraints(SearchQuery query)
Tests if the query contains additional constraints, i.e. on relations or nodes.

Parameters:
query - the query.
Returns:
true if the query containts additional constraints, false otherwise.

containsOtherStringSearchConstraints

protected boolean containsOtherStringSearchConstraints(Constraint constraint,
                                                       StringSearchConstraint searchConstraint)
Tests if a constaint is/contains another stringsearch constraint than the specified one. Recursively seaches through all childs of composite constraints.

Parameters:
constraint - the constraint.
searchConstraint - the stringsearch constraint.


MMBase build 1.7.1.20041002