no.sesat.search.result
Interface ResultList<T extends ResultItem>

Type Parameters:
T - the result item type the list contains.
All Superinterfaces:
ResultItem, Serializable
All Known Subinterfaces:
FacetedSearchResult<T>, NavigationItem
All Known Implementing Classes:
BasicNavigationItem, BasicResultList, FacetedSearchResultImpl, FastSearchResult, OvertureSearchResult, PlatefoodSearchResult

public interface ResultList<T extends ResultItem>
extends ResultItem

A list of ResultItems. The list itself is a "result" that contain properties (suggestions, relevant queries, etc).

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

Method Summary
 ResultList<T> addField(String name, String value)
          Opposed to the superinterface, ResultLists can mutate and this method will return itself.
 ResultList<T> addObjectField(String name, Serializable value)
          Opposed to the superinterface, ResultLists can mutate and this method will return itself.
 void addQuerySuggestion(Suggestion query)
           
 void addResult(T item)
          Adds the result to the end of the current list of results.
 void addResults(List<? extends T> item)
          Appends the results to the end of the current list of results.
 void addSpellingSuggestion(WeightedSuggestion suggestion)
           
 int getHitCount()
          Get the hitcount.
 Collection<Suggestion> getQuerySuggestions()
           
 List<WeightedSuggestion> getRelevantQueries()
           
 List<T> getResults()
          Returns a defensive copy of the results.
 List<WeightedSuggestion> getSpellingSuggestions()
           
 void removeResult(T item)
          Remove the result from the current result list.
 void removeResults()
          Remove all results from the current result list.
 void replaceResult(T original, T theNew)
          Replace the original with theNew.
 void setHitCount(int hitCount)
          Set the hitcount.
 void sortResults(Comparator comparator)
          Sorts the results according to the order induced by the specified comparator.
 
Methods inherited from interface no.sesat.search.result.ResultItem
addToMultivaluedField, getField, getFieldNames, getMultivaluedField, getObjectField, getTitle, getUrl, setTitle, setUrl
 

Method Detail

getHitCount

int getHitCount()
Get the hitcount. May not match getResults().size().

Returns:

setHitCount

void setHitCount(int hitCount)
Set the hitcount.

Parameters:
hitCount -

getResults

List<T> getResults()
Returns a defensive copy of the results. To update a ResultItem in the list use replaceResult(original, theNew). Implementations of this method are free to return a live copy and document such, but the default defined behaviour is of an restricted API.

Returns:

addResult

void addResult(T item)
Adds the result to the end of the current list of results.

Parameters:
item -

addResults

void addResults(List<? extends T> item)
Appends the results to the end of the current list of results.

Parameters:
item -

replaceResult

void replaceResult(T original,
                   T theNew)
Replace the original with theNew.

Parameters:
original -
theNew -

removeResult

void removeResult(T item)
Remove the result from the current result list.

Parameters:
item -

removeResults

void removeResults()
Remove all results from the current result list.


sortResults

void sortResults(Comparator comparator)
Sorts the results according to the order induced by the specified comparator.

Parameters:
comparator -

getSpellingSuggestions

List<WeightedSuggestion> getSpellingSuggestions()
Returns:

addSpellingSuggestion

void addSpellingSuggestion(WeightedSuggestion suggestion)
Parameters:
suggestion -

getQuerySuggestions

Collection<Suggestion> getQuerySuggestions()
Returns:

addQuerySuggestion

void addQuerySuggestion(Suggestion query)
Parameters:
query -

getRelevantQueries

List<WeightedSuggestion> getRelevantQueries()
Returns:

addField

ResultList<T> addField(String name,
                       String value)
Opposed to the superinterface, ResultLists can mutate and this method will return itself. Adds the field to the returned instance which is otherwise equal to this. There is no guarantee that this instance is altered. This allows implementations to be immutable if they choose to be. Use addObjectField to add a non-html string into the result.

Specified by:
addField in interface ResultItem
Parameters:
name -
value - html formatted string. html to display must be escaped.
Returns:

addObjectField

ResultList<T> addObjectField(String name,
                             Serializable value)
Opposed to the superinterface, ResultLists can mutate and this method will return itself. Adds the field to the returned instance which is otherwise equal to this. There is no guarantee that this instance is altered. This allows implementations to be immutable if they choose to be.

Specified by:
addObjectField in interface ResultItem
Parameters:
name -
value -
Returns:


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