no.sesat.search.query.token
Class RegExpTokenEvaluator

java.lang.Object
  extended by no.sesat.search.query.token.RegExpTokenEvaluator
All Implemented Interfaces:
TokenEvaluator

public final class RegExpTokenEvaluator
extends Object
implements TokenEvaluator

An implementation of TokenEvaluator which uses a set of Pattern to decide if a token occurs in a query. Immutable

Version:
$Id: RegExpTokenEvaluator.java 7225 2009-04-09 00:32:20Z ssmiweve $

Constructor Summary
RegExpTokenEvaluator(Collection<Pattern> expressions, boolean queryDependant)
          Create a new RegExpTokenEvaluator.
 
Method Summary
 boolean evaluateToken(TokenPredicate token, String term, String query)
          Returns true if any of the patterns matches the query.
 Set<String> getMatchValues(TokenPredicate token, String term)
          Each true evaluation may also provide a synonym (or "match value").
 boolean isQueryDependant(TokenPredicate predicate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegExpTokenEvaluator

public RegExpTokenEvaluator(Collection<Pattern> expressions,
                            boolean queryDependant)
Create a new RegExpTokenEvaluator.

Parameters:
expressions - the patterns to use. Elements of collection must be Pattern.
queryDependant -
Method Detail

evaluateToken

public boolean evaluateToken(TokenPredicate token,
                             String term,
                             String query)
Returns true if any of the patterns matches the query. Wraps to evaluateToken with exactMatchRequired == false

Specified by:
evaluateToken in interface TokenEvaluator
Parameters:
token - not used by this implementation.
term - the term currently parsing.
query - the query to find matches in. can be null. this indicates we can just use the term.
Returns:
true if any of the patterns matches.

isQueryDependant

public boolean isQueryDependant(TokenPredicate predicate)
Specified by:
isQueryDependant in interface TokenEvaluator
Returns:

getMatchValues

public Set<String> getMatchValues(TokenPredicate token,
                                  String term)
Description copied from interface: TokenEvaluator
Each true evaluation may also provide a synonym (or "match value").

Specified by:
getMatchValues in interface TokenEvaluator
Returns:
a list of Tokens


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