Class 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 SRUScanResultSet object maintains a cursor pointing to its current term. Initially the cursor is positioned before the first term. The next method moves the cursor to the next term, and because it returns false when there are no more terms in the SRUScanResultSet object, it can be used in a while loop to iterate through the term set.

    This class needs to be implemented for the target search engine.

    See Also:
    SRU Scan Operation
    • Constructor Detail

      • SRUScanResultSet

        protected SRUScanResultSet​(SRUDiagnosticList diagnostics)
        Constructor.
        Parameters:
        diagnostics - an instance of a SRUDiagnosticList.
        See Also:
        SRUDiagnosticList
    • Method Detail

      • nextTerm

        public abstract boolean nextTerm()
                                  throws SRUException
        Moves 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 method next makes the first term the current term; the second call makes the second term the current term, and so on.

        When a call to the next method returns false, the cursor is positioned after the last term.

        Returns:
        true if the new current term is valid; false if there are no more terms
        Throws:
        SRUException - if an error occurred while fetching the next term
      • getValue

        public abstract String getValue()
        Get the current term exactly as it appears in the index.
        Returns:
        current term
      • getNumberOfRecords

        public 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.
      • getDisplayTerm

        public 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
      • getWhereInList

        public 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
      • hasExtraTermData

        public boolean hasExtraTermData()
        Check, if extra term data should be serialized for the current term. A default implementation is provided for convince and always returns false.
        Returns:
        true if the term has extra term data
        Throws:
        NoSuchElementException - term set is already advanced past all past terms
        See Also:
        writeExtraTermData(XMLStreamWriter)
      • addDiagnostic

        protected 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
      • addDiagnostic

        protected 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
      • addDiagnostic

        protected final void addDiagnostic​(String uri)
        Add a non surrogate diagnostic to the response.
        Parameters:
        uri - the diagnostic's identifying URI
      • hasExtraResponseData

        public boolean hasExtraResponseData()
        Check, if extra response data should be serialized for this request. Default implementation is provided for convince and always returns false.
        Returns:
        true if extra response data should be serialized.
        See Also:
        writeExtraResponseData(XMLStreamWriter)
      • close

        public void close()
        Release this result and free any associated resources.

        This method must not throw any exceptions

        Calling the method close on a result object that is already closed is a no-op.