Class SearchDocumentList

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.Iterable<SearchDocument>

    public class SearchDocumentList
    extends java.lang.Object
    implements java.lang.Iterable<SearchDocument>, java.io.Externalizable
    A list of SearchDocuments returned for a query.

    The size of the list will be less than or equal to the number of rows requested via QueryRequest.setRows(long).

    See Also:
    Serialized Form
    • Constructor Detail

      • SearchDocumentList

        public SearchDocumentList()
        The default constructor
      • SearchDocumentList

        public SearchDocumentList​(int initialSize)
        Constructor
        Parameters:
        initialSize - the initial size
    • Method Detail

      • getOffset

        public long getOffset()
        Get the offset that into the overall result set for the first document in this SearchDocumentList.
      • setOffset

        public void setOffset​(long value)
        Set the offset that into the overall result set for the first document in this SearchDocumentList.
      • getNumberFound

        public long getNumberFound()
      • setNumberFound

        public void setNumberFound​(long nf)
      • setMaxScore

        public void setMaxScore​(float value)
      • size

        public int size()
      • forEach

        public void forEach​(java.util.function.Consumer<? super SearchDocument> consumer)
        Specified by:
        forEach in interface java.lang.Iterable<SearchDocument>
      • clear

        public void clear()
      • getMaxScore

        public float getMaxScore()
        Get the maximum score across all matching documents.

        NOTE: this will be 0.0 if the result is not orderd by score and document scores are not requested. Adding FieldNames.SCORE field to QueryRequest will force computation of max score.

      • containsDocument

        public boolean containsDocument​(java.lang.String docID)
        Tells whether this document list contains a given document based on document ID.
        Parameters:
        docID - the document ID
        Returns:
        true if the list contains a document with the specified ID
      • getDocument

        public SearchDocument getDocument​(java.lang.String id)
        Gets a document from this list by ID.
        Parameters:
        id - the ID to look for
        Returns:
        the document or null if not in this list
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException
        Specified by:
        readExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
      • writeExternal

        public void writeExternal​(java.io.ObjectOutput out)
                           throws java.io.IOException
        Specified by:
        writeExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException