org.dftproject.genesis.core.search
Class AbstractSearchHitCollector

java.lang.Object
  extended by org.dftproject.genesis.core.search.AbstractSearchHitCollector
Direct Known Subclasses:
SimpleSearchHitCollector

public abstract class AbstractSearchHitCollector
extends java.lang.Object

A search hit collector retrieves search results and ranks them.


Constructor Summary
AbstractSearchHitCollector()
           
 
Method Summary
 void addHitListener(HitListener listener)
          Adds a hit listener.
 void notifyHitListeners(double score, IResourceNode individual)
          Notifies all hit listeners of a new (or updated) hit.
 void removeHitListener(HitListener listener)
          Removes a hit listener.
abstract  void start(IResourceNode query)
          Starts collecting search results for the given query.
abstract  void stop()
          Stops collecting search results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSearchHitCollector

public AbstractSearchHitCollector()
Method Detail

start

public abstract void start(IResourceNode query)
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.

Parameters:
query - the query

stop

public abstract void stop()
Stops collecting search results.


addHitListener

public void addHitListener(HitListener listener)
Adds a hit listener.

Parameters:
listener - a hit listener

removeHitListener

public void removeHitListener(HitListener listener)
Removes a hit listener.

Parameters:
listener - a hit listener

notifyHitListeners

public void notifyHitListeners(double score,
                               IResourceNode individual)
Notifies all hit listeners of a new (or updated) hit.

Additional information on a resource may be found, which may change that resource's score. When this happens, the listeners will be renotified of the same search result, but with the updated score.

Parameters:
score - the score for this search result
individual - the search result