Class ResultDocList

All Implemented Interfaces:
Iterable, Collection, List, SequencedCollection

public class ResultDocList extends AbstractList
A List of ResultDocs returned by a SimpleLucenIndex search.
Author:
John Weatherley
See Also:
  • Constructor Details

    • ResultDocList

      public ResultDocList()
      Creates an empty ResultDocList that can not be expanded.
    • ResultDocList

      public ResultDocList(ResultDoc[] resultDocs)
      Creates a ResultDocList backed by the given resultDocs that can not be expanded.
      Parameters:
      resultDocs - The result docs that back this ResultDocList.
    • ResultDocList

      public ResultDocList(org.apache.lucene.search.TopDocs topDocs, ResultDocConfig resultDocConfig)
      Creates a ResultDocList backed by the given search results that can not be expanded. Constructed by SimpleLuceneIndex when a search is made.
      Parameters:
      topDocs - The TopDocs
      resultDocConfig - The config
  • Method Details

    • get

      public ResultDoc get(int i)
      Get the ResultDoc at the given location.
      Specified by:
      get in interface List
      Specified by:
      get in class AbstractList
      Parameters:
      i - Index
      Returns:
      The ResultDoc
    • size

      public int size()
      The number of search results.
      Specified by:
      size in interface Collection
      Specified by:
      size in interface List
      Specified by:
      size in class AbstractCollection
      Returns:
      The number of search results.
    • toArray

      public ResultDoc[] toArray()
      Gets the ResultDocs as an array. Note that this is significantly less efficient than using the List methods for access.
      Specified by:
      toArray in interface Collection
      Specified by:
      toArray in interface List
      Overrides:
      toArray in class AbstractCollection
      Returns:
      The ResultDocs
    • getDateStamp

      public static final String getDateStamp()
      Gets a datestamp of the current time formatted for display with logs and output.
      Returns:
      A datestamp for display purposes.
    • setDebug

      public static void setDebug(boolean db)
      Sets the debug attribute of the SimpleLuceneIndex object
      Parameters:
      db - The new debug value