Regain 2.1.0-STABLE API

net.sf.regain.search.results
Interface SearchResults

All Known Implementing Classes:
SearchResultsImpl

public interface SearchResults

Holds the results of one search.

Author:
Til Schneider, www.murfman.de
See Also:
SearchToolkit.getSearchResults(net.sf.regain.util.sharedtag.PageRequest)

Method Summary
 int getDocumentCount()
          Gets the number of documents in the in index.
 int getHitCount()
          Gets the number of hits the search had.
 org.apache.lucene.document.Document getHitDocument(int index)
          Gets the document of one hit.
 String getHitIndexName(int index)
          Gets the name of the index a hit comes from.
 float getHitScore(int index)
          Gets the score of one hit.
 String getHitUrl(int index)
          Gets the url from a hit and rewrites it according to the rewrite rules specified in the index config.
 boolean getOpenHitInNewWindow(int index)
          Gets whether a hit should be opened in a new window.
 int getSearchTime()
          Gets the time the search took in milliseconds.
 boolean getShouldHighlight(int index)
          Gets whether the search terms should be highlighted
 boolean getUseFileToHttpBridgeForHit(int index)
          Gets whether the file-to-http-bridge should be used for a certain hit.
 void highlightHitDocument(int index)
          Highlights fields in the document.
 void shortenSummary(int index)
          Shortens the summary.
 

Method Detail

getHitCount

int getHitCount()
Gets the number of hits the search had.

Returns:
the number of hits the search had.

getDocumentCount

int getDocumentCount()
Gets the number of documents in the in index.

Returns:
the number of indexed documents.

getHitDocument

org.apache.lucene.document.Document getHitDocument(int index)
                                                   throws RegainException
Gets the document of one hit.

Parameters:
index - The index of the hit.
Returns:
the document of one hit.
Throws:
RegainException - If getting the document failed.
See Also:
Document

getHitScore

float getHitScore(int index)
                  throws RegainException
Gets the score of one hit.

Parameters:
index - The index of the hit.
Returns:
the score of one hit.
Throws:
RegainException - If getting the score failed.
See Also:
Hits#score(int)

getHitUrl

String getHitUrl(int index)
                 throws RegainException
Gets the url from a hit and rewrites it according to the rewrite rules specified in the index config.

Parameters:
index - The index of the hit to get the URL for.
Returns:
The url of the wanted hit.
Throws:
RegainException - If getting the hit document failed.

getHitIndexName

String getHitIndexName(int index)
                       throws RegainException
Gets the name of the index a hit comes from.

Parameters:
index - The index of the hit to get the index name for.
Returns:
The name of the index a hit comes from.
Throws:
RegainException - If getting the index name failed.

getOpenHitInNewWindow

boolean getOpenHitInNewWindow(int index)
                              throws RegainException
Gets whether a hit should be opened in a new window.

Parameters:
index - The index of the hit.
Returns:
Whether the hit should be opened in a new window.
Throws:
RegainException - If the hit could not be read.

getUseFileToHttpBridgeForHit

boolean getUseFileToHttpBridgeForHit(int index)
                                     throws RegainException
Gets whether the file-to-http-bridge should be used for a certain hit.

Mozilla browsers have a security mechanism that blocks loading file-URLs from pages loaded via http. To be able to load files from the search results, regain offers the file-to-http-bridge that provides all files that are listed in the index via http.

Parameters:
index - The index of the hit.
Returns:
Whether the file-to-http-bridge should be used.
Throws:
RegainException - If the hit could not be read.

getSearchTime

int getSearchTime()
Gets the time the search took in milliseconds.

Returns:
The search time.

highlightHitDocument

void highlightHitDocument(int index)
                          throws RegainException
Highlights fields in the document.

Parameters:
index - The index of the hit.
Throws:
RegainException - If highlighting failed.
See Also:
Document

getShouldHighlight

boolean getShouldHighlight(int index)
                           throws RegainException
Gets whether the search terms should be highlighted

Returns:
whether to highlight
Throws:
RegainException - If the value could not read from config

shortenSummary

void shortenSummary(int index)
                    throws RegainException
Shortens the summary.

Parameters:
index - The index of the hit.
Throws:
RegainException - if shorten fails.

Regain 2.1.0-STABLE API

Regain 2.1.0-STABLE, Copyright (C) 2004-2010 Til Schneider, www.murfman.de, Thomas Tesche, www.clustersystems.info