com.sun.labs.minion
Interface Passage

All Known Implementing Classes:
PassageImpl

public interface Passage

An interface for a class that holds the information for a passage generated from a search. Classes that implement this interface can be used to get highlighted and un-highlighted versions of the passage for display.


Nested Class Summary
static class Passage.Type
          The types of passage that we will return.
 
Method Summary
 java.lang.String getHLValue()
          Gets the highlighted value for this passage.
 java.lang.String getHLValue(boolean elided)
          Gets the highlighted value for this passage.
 int[] getMatchEnd()
          Gets the ending character positions in the document for the terms that make up the passage.
 java.lang.String[] getMatchingTerms()
          Gets the terms from the passage that match the terms in the query.
 int[] getMatchStart()
          Gets the starting character positions in the document for the terms that make up the passage.
 float getScore()
          Gets the penalty score associated with this passage.
 java.lang.String getUnHLValue(boolean elided)
          Gets the unhighlighted value for this passage.
 int[] getWordPositions()
          Gets the character positions of the passage words in the highlighted passage string that was returned earlier.
 java.lang.String highlight(PassageHighlighter highlighter)
          Marks up the passage using the highlighter.
 java.lang.String highlight(PassageHighlighter highlighter, boolean htmlEncode)
          Marks up the passage using the highlighter.
 

Method Detail

getScore

float getScore()
Gets the penalty score associated with this passage.

Returns:
the score associated with this passage

highlight

java.lang.String highlight(PassageHighlighter highlighter,
                           boolean htmlEncode)
Marks up the passage using the highlighter.

Parameters:
highlighter - The highlighter that will be used to mark up the passage. If this is null no highlighting will be done.
htmlEncode - If true the highlighted passage will have its text HTML encoded so that it may be safely given to a Web browser.
Returns:
the highlighted passage, cut down to the size specified when the passage was defined.
See Also:
getHLValue(boolean), getUnHLValue(boolean)

highlight

java.lang.String highlight(PassageHighlighter highlighter)
Marks up the passage using the highlighter.

Parameters:
highlighter - The highlighter that will be used to mark up the passage. If this is null no highlighting will be done.
Returns:
the highlighted passage, cut down to the size specified when the passage was defined.
See Also:
getHLValue(boolean), getUnHLValue(boolean)

getHLValue

java.lang.String getHLValue(boolean elided)
Gets the highlighted value for this passage.

Parameters:
elided - If true returns the passage cut down to the size specified when the passages were made. If false the unelided, highlighted passage is returned.
Returns:
the highlighted value for this passage

getHLValue

java.lang.String getHLValue()
Gets the highlighted value for this passage. The passage will be cut down to the size specified when the passages were made.

Returns:
a highlighted string containing the passage.

getUnHLValue

java.lang.String getUnHLValue(boolean elided)
Gets the unhighlighted value for this passage.

Parameters:
elided - If true returns the passage cut down to the size specified when the passages were made. If false the unelided, unhighlighted passage is returned.
Returns:
the unhighlighted value of the passage

getWordPositions

int[] getWordPositions()
Gets the character positions of the passage words in the highlighted passage string that was returned earlier. This really only makes sense if you didn't ask for highlighting!

Returns:
the character positions of the words in the highlighted passage string

getMatchingTerms

java.lang.String[] getMatchingTerms()
Gets the terms from the passage that match the terms in the query.

Returns:
an array of strings containing the terms that were found in the document that match the terms from the query that generated this document. If an element of the array is null, then that means that a term is missing from the passage.

getMatchStart

int[] getMatchStart()
Gets the starting character positions in the document for the terms that make up the passage.

Returns:
an array containing the character positions of the start of each term that appears in the passage. The position of the start of the term is defined as the position of the first letter in the term. This information can be used if it is necessary to highlight the actual document for display.

getMatchEnd

int[] getMatchEnd()
Gets the ending character positions in the document for the terms that make up the passage.

Returns:
an array containing the character positions of the end of each term that appears in the passage. The position of the end of a term is defined as the position after the position of the last character in the word. This information can be used if it is necessary to highlight the actual document for display.