no.sesat.search.query.finder
Class WhoWhereSplitter

java.lang.Object
  extended by no.sesat.commons.visitor.AbstractReflectionVisitor
      extended by no.sesat.search.query.finder.WhoWhereSplitter
All Implemented Interfaces:
no.sesat.commons.visitor.Visitor

public final class WhoWhereSplitter
extends no.sesat.commons.visitor.AbstractReflectionVisitor

Essentially a QueryTransformer, the similarity is also evident in the context required.
But because it splits the one query into two it doesn't fit into the command's query transformation chain, and is used by commands manually instead.
This class splits the query provided in the context into a who and where components. These are returned as strings in the WhoWhereSplit class and the user is expected to parse each into separate query objects if required.
The specifications of the split are complicated and were originally given by sesam.se's HittaSearchCommand.
If a query contains multiple fullnames and/or companynames then both who and where will be returned blank.
If just one fullname or companyname is found none of it's terms are moved to the where component.
Otherwise terms which match a geological tokenPredicate and do not match a name or phoneNumber tokenPredicate are moved to the where component.

It is guaranteed that all terms in the original query can be found in either the who or where components except the case when both components are blank.

The usefulness of this class is heavy dependant on the TokenPredicates: FULLNAME, COMPANYNAME, COMPANY_KEYWORD, FIRSTNAME, LASTNAME, GEOGLOBAL, and GEOLOCAL; being kept available and uptodate.

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

Nested Class Summary
static class WhoWhereSplitter.Application
           
static interface WhoWhereSplitter.Context
          Context this class requires to work within.
static class WhoWhereSplitter.WhoWhereSplit
           
 
Field Summary
 
Fields inherited from class no.sesat.commons.visitor.AbstractReflectionVisitor
VISIT_METHOD_IMPL
 
Constructor Summary
WhoWhereSplitter(WhoWhereSplitter.Context context)
          Creates a new instance of WhoWhereSplitter
 
Method Summary
 WhoWhereSplitter.WhoWhereSplit getWhoWhereSplit()
           
protected  void visitImpl(AndNotClause clause)
           
protected  void visitImpl(BinaryClause clause)
           
protected  void visitImpl(LeafClause clause)
           
protected  void visitImpl(NotClause clause)
           
protected  void visitImpl(UnaryClause clause)
           
protected  void visitImpl(XorClause clause)
           
 
Methods inherited from class no.sesat.commons.visitor.AbstractReflectionVisitor
visit, visitImpl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WhoWhereSplitter

public WhoWhereSplitter(WhoWhereSplitter.Context context)
Creates a new instance of WhoWhereSplitter

Parameters:
context -
Method Detail

getWhoWhereSplit

public WhoWhereSplitter.WhoWhereSplit getWhoWhereSplit()
Returns:

visitImpl

protected void visitImpl(LeafClause clause)
Parameters:
clause -

visitImpl

protected void visitImpl(UnaryClause clause)
Parameters:
clause -

visitImpl

protected void visitImpl(BinaryClause clause)
Parameters:
clause -

visitImpl

protected void visitImpl(NotClause clause)
Parameters:
clause -

visitImpl

protected void visitImpl(AndNotClause clause)
Parameters:
clause -

visitImpl

protected void visitImpl(XorClause clause)
Parameters:
clause -


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