Package eu.clarin.sru.server
Class SRUScanResultSet
- java.lang.Object
- 
- eu.clarin.sru.server.SRUScanResultSet
 
- 
 public abstract class SRUScanResultSet extends Object A result set of a scan operation. It is used to iterate over the term set and provides a method to serialize the terms.A SRUScanResultSetobject maintains a cursor pointing to its current term. Initially the cursor is positioned before the first term. Thenextmethod moves the cursor to the next term, and because it returnsfalsewhen there are no more terms in theSRUScanResultSetobject, it can be used in awhileloop to iterate through the term set.This class needs to be implemented for the target search engine. - See Also:
- SRU Scan Operation
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSRUScanResultSet.WhereInListA flag to indicate the position of the term within the complete term list.
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedSRUScanResultSet(SRUDiagnosticList diagnostics)Constructor.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddDiagnostic(String uri)Add a non surrogate diagnostic to the response.protected voidaddDiagnostic(String uri, String details)Add a non surrogate diagnostic to the response.protected voidaddDiagnostic(String uri, String details, String message)Add a non surrogate diagnostic to the response.voidclose()Release this result and free any associated resources.abstract StringgetDisplayTerm()Get the string for the current term to display to the end user in place of the term itself.abstract intgetNumberOfRecords()Get the number of records for the current term which would be matched if the index in the request's scanClause was searched with the term in the value field.abstract StringgetValue()Get the current term exactly as it appears in the index.abstract SRUScanResultSet.WhereInListgetWhereInList()Get the flag to indicate the position of the term within the complete term list.booleanhasExtraResponseData()Check, if extra response data should be serialized for this request.booleanhasExtraTermData()Check, if extra term data should be serialized for the current term.abstract booleannextTerm()Moves the cursor forward one term from its current position.voidwriteExtraResponseData(XMLStreamWriter writer)Serialize extra response data for this request.voidwriteExtraTermData(XMLStreamWriter writer)Serialize extra term data for the current term.
 
- 
- 
- 
Constructor Detail- 
SRUScanResultSetprotected SRUScanResultSet(SRUDiagnosticList diagnostics) Constructor.- Parameters:
- diagnostics- an instance of a SRUDiagnosticList.
- See Also:
- SRUDiagnosticList
 
 
- 
 - 
Method Detail- 
nextTermpublic abstract boolean nextTerm() throws SRUExceptionMoves the cursor forward one term from its current position. A result set cursor is initially positioned before the first record; the first call to the methodnextmakes the first term the current term; the second call makes the second term the current term, and so on.When a call to the nextmethod returnsfalse, the cursor is positioned after the last term.- Returns:
- trueif the new current term is valid;- falseif there are no more terms
- Throws:
- SRUException- if an error occurred while fetching the next term
 
 - 
getValuepublic abstract String getValue() Get the current term exactly as it appears in the index.- Returns:
- current term
 
 - 
getNumberOfRecordspublic abstract int getNumberOfRecords() Get the number of records for the current term which would be matched if the index in the request's scanClause was searched with the term in the value field.- Returns:
- a non-negative number of records or
         -1, if the number is unknown.
 
 - 
getDisplayTermpublic abstract String getDisplayTerm() Get the string for the current term to display to the end user in place of the term itself.- Returns:
- display string or null
 
 - 
getWhereInListpublic abstract SRUScanResultSet.WhereInList getWhereInList() Get the flag to indicate the position of the term within the complete term list.- Returns:
- position within term list or null
 
 - 
hasExtraTermDatapublic boolean hasExtraTermData() Check, if extra term data should be serialized for the current term. A default implementation is provided for convince and always returnsfalse.- Returns:
- trueif the term has extra term data
- Throws:
- NoSuchElementException- term set is already advanced past all past terms
- See Also:
- writeExtraTermData(XMLStreamWriter)
 
 - 
writeExtraTermDatapublic void writeExtraTermData(XMLStreamWriter writer) throws XMLStreamException Serialize extra term data for the current term. A no-op default implementation is provided for convince.- Parameters:
- writer- the- XMLStreamExceptioninstance to be used
- Throws:
- XMLStreamException- an error occurred while serializing the term extra data
- NoSuchElementException- result set already advanced past all terms
- See Also:
- hasExtraTermData()
 
 - 
addDiagnosticprotected final void addDiagnostic(String uri, String details, String message) Add a non surrogate diagnostic to the response.- Parameters:
- uri- the diagnostic's identifying URI
- details- supplementary information available, often in a format specified by the diagnostic or- null
- message- human readable message to display to the end user or- null
 
 - 
addDiagnosticprotected final void addDiagnostic(String uri, String details) Add a non surrogate diagnostic to the response.- Parameters:
- uri- the diagnostic's identifying URI
- details- supplementary information available, often in a format specified by the diagnostic or- null
 
 - 
addDiagnosticprotected final void addDiagnostic(String uri) Add a non surrogate diagnostic to the response.- Parameters:
- uri- the diagnostic's identifying URI
 
 - 
hasExtraResponseDatapublic boolean hasExtraResponseData() Check, if extra response data should be serialized for this request. Default implementation is provided for convince and always returnsfalse.- Returns:
- trueif extra response data should be serialized.
- See Also:
- writeExtraResponseData(XMLStreamWriter)
 
 - 
writeExtraResponseDatapublic void writeExtraResponseData(XMLStreamWriter writer) throws XMLStreamException Serialize extra response data for this request.- Parameters:
- writer- the- XMLStreamExceptioninstance to be used
- Throws:
- XMLStreamException- an error occurred while serializing the result
- See Also:
- hasExtraResponseData()
 
 - 
closepublic void close() Release this result and free any associated resources.This method must not throw any exceptions Calling the method closeon a result object that is already closed is a no-op.
 
- 
 
-