org.dftproject.genesis.core.search
Class SimpleSearchHitCollector

java.lang.Object
  extended by org.dftproject.genesis.core.search.AbstractSearchHitCollector
      extended by org.dftproject.genesis.core.search.SimpleSearchHitCollector

public class SimpleSearchHitCollector
extends AbstractSearchHitCollector

A simple implementation of a hit collector.


Field Summary
static java.lang.String ID
          The SimpleSearchHitCollector ID.
 
Constructor Summary
SimpleSearchHitCollector()
           
 
Method Summary
protected  double getDateScore(java.lang.String predicate, IResourceNode expected, IResourceNode value)
          Returns the score for a date comparison for the given field between the given search result and the given query example.
protected  double getGenderScore(IResourceNode expected, IResourceNode value)
          Returns the score for a gender comparison between the given search result and the given query example.
protected  double getNameScore(IResourceNode expected, IResourceNode value)
          Returns the score for a name comparison between the given search result and the given query example.
protected  double getPlaceScore(java.lang.String predicate, IResourceNode expected, IResourceNode value)
          Returns the score for a place comparison for the given field between the given search result and the given query example.
 double getScore(IResourceNode expected, IResourceNode value)
          Returns the score for a given search result compared to the given query example.
 double getThreshold()
          Returns the minimum score cut-off for a "good" search result.
 void start(IResourceNode query)
          Starts collecting search results for the given query.
 void stop()
          Stops collecting search results.
 
Methods inherited from class org.dftproject.genesis.core.search.AbstractSearchHitCollector
addHitListener, notifyHitListeners, removeHitListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final java.lang.String ID
The SimpleSearchHitCollector ID.

See Also:
Constant Field Values
Constructor Detail

SimpleSearchHitCollector

public SimpleSearchHitCollector()
Method Detail

start

public void start(IResourceNode query)
Description copied from class: AbstractSearchHitCollector
Starts collecting search results for the given query.

The query is given as an example. The hit collector should try to collect resources that are similar to the query example. Score should reflect how closely a resource matches the query example.

Specified by:
start in class AbstractSearchHitCollector
Parameters:
query - the query

stop

public void stop()
Description copied from class: AbstractSearchHitCollector
Stops collecting search results.

Specified by:
stop in class AbstractSearchHitCollector

getThreshold

public double getThreshold()
Returns the minimum score cut-off for a "good" search result. Listeners will not be notified of any search result with a lower score.

Returns:
the threshold score

getScore

public double getScore(IResourceNode expected,
                       IResourceNode value)
Returns the score for a given search result compared to the given query example.

Parameters:
expected - the query example
value - the search result
Returns:
the score

getNameScore

protected double getNameScore(IResourceNode expected,
                              IResourceNode value)
Returns the score for a name comparison between the given search result and the given query example.

Parameters:
expected - the query example
value - the search result
Returns:
the score

getDateScore

protected double getDateScore(java.lang.String predicate,
                              IResourceNode expected,
                              IResourceNode value)
Returns the score for a date comparison for the given field between the given search result and the given query example.

Parameters:
predicate - the field
expected - the query example
value - the search result
Returns:
the score

getPlaceScore

protected double getPlaceScore(java.lang.String predicate,
                               IResourceNode expected,
                               IResourceNode value)
Returns the score for a place comparison for the given field between the given search result and the given query example.

Parameters:
predicate - the field
expected - the query example
value - the search result
Returns:
the score

getGenderScore

protected double getGenderScore(IResourceNode expected,
                                IResourceNode value)
Returns the score for a gender comparison between the given search result and the given query example.

Parameters:
expected - the query example
value - the search result
Returns:
the score