no.sesat.search.query.parser
Class AbstractQuery

java.lang.Object
  extended by no.sesat.search.query.parser.AbstractQuery
All Implemented Interfaces:
Serializable, Query

public abstract class AbstractQuery
extends Object
implements Query

Abstract helper for implementing a Query class. Handles input of the query string and finding the first leaf clause (term) in the clause hierarchy. Is thread safe. No methods return null.

Version:
$Id: AbstractQuery.java 7225 2009-04-09 00:32:20Z ssmiweve $
See Also:
Serialized Form

Constructor Summary
protected AbstractQuery(String queryStr)
          Creates a new instance of AbstractQuery .
 
Method Summary
static Query createQuery(String string, boolean blank, Clause rootClause, ParentFinder parentFinder)
           
 TokenEvaluationEngine.State getEvaluationState()
          Returns the object that holds State for any TokenEvaluationEngine actions.
 LeafClause getFirstLeafClause()
          The first term (leaf clause) in the query.
 String getQueryString()
          The original string the user entered for the search.
 int getTermCount()
          Return the number of terms in this query.
 boolean isBlank()
          Is the query blank (or just full of useless symbols).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface no.sesat.search.query.Query
getParentFinder, getRootClause
 

Constructor Detail

AbstractQuery

protected AbstractQuery(String queryStr)
Creates a new instance of AbstractQuery .

Parameters:
queryStr - the query string as inputted from the user.
Method Detail

createQuery

public static Query createQuery(String string,
                                boolean blank,
                                Clause rootClause,
                                ParentFinder parentFinder)

getQueryString

public String getQueryString()
Description copied from interface: Query
The original string the user entered for the search. This string should never be used programmatically or passed to search indexes. It is only intended for display and feedback.

Specified by:
getQueryString in interface Query
Returns:
the original user's query.

getFirstLeafClause

public LeafClause getFirstLeafClause()
Description copied from interface: Query
The first term (leaf clause) in the query.

Specified by:
getFirstLeafClause in interface Query
Returns:
the first leaf clause.

getTermCount

public int getTermCount()
Description copied from interface: Query
Return the number of terms in this query. Terms are represented by LeafClauses.

Specified by:
getTermCount in interface Query
Returns:

isBlank

public boolean isBlank()
Description copied from interface: Query
Is the query blank (or just full of useless symbols).

Specified by:
isBlank in interface Query
Returns:

getEvaluationState

public TokenEvaluationEngine.State getEvaluationState()
Description copied from interface: Query
Returns the object that holds State for any TokenEvaluationEngine actions.

Specified by:
getEvaluationState in interface Query
Returns:
the object that holds State for any TokenEvaluationEngine actions.


Copyright © 2005-2009 Schibsted ASA. All Rights Reserved.