Class SearchResults


  • public class SearchResults
    extends Object
    This represents the return data from a search
    Author:
    Aaron Zeckoski (azeckoski @ gmail.com)
    • Field Detail

      • query

        public String query
        The search query that was performed
      • startIndex

        public int startIndex
        The index (position) of the result item to started on (used for paging)
        0 indicates the default value (start at the beginning)
      • maxItemsToReturn

        public int maxItemsToReturn
        The maximum number of results returned after the startindex, 0 indicates the default value (all items)
      • totalItemsMatched

        public int totalItemsMatched
        The total number of items matched by the search
      • originalQuery

        public String originalQuery
        This is a holder for the original query before it is adjusted
      • itemsPerPage

        public int itemsPerPage
        for paging the results
    • Constructor Detail

      • SearchResults

        public SearchResults()
      • SearchResults

        public SearchResults​(String query,
                             int startIndex,
                             int maxItemsToReturn)
      • SearchResults

        public SearchResults​(int start,
                             int max,
                             int total,
                             List<SearchResult> results)
        use this constructor to build search results manually
    • Method Detail

      • addResult

        public boolean addResult​(SearchContent content)
        Add results to the total results, this will not allow adding results beyond the totalItemsMatched (max) number
        Parameters:
        steepleItem - the result to add
        Returns:
        true if the item was added OR false if it was null or the max number is already added
      • addResult

        public boolean addResult​(SearchResult searchResult)
        Add results to the total results, this will not allow adding results beyond the maxItemsToReturn (max) number
        Parameters:
        searchResult - the result to add
        Returns:
        true if the item was added OR false if it was null or the max number is already added
      • getQuery

        public String getQuery()
      • getStartIndex

        public int getStartIndex()
        Returns:
        the starting index for these results (starts at 0)
      • getEndIndex

        public int getEndIndex()
        Returns:
        the ending index based on the start index and the max items to return (not based on the actual items in the results), return the max int if the max is 0
      • getMaxItemsToReturn

        public int getMaxItemsToReturn()
        Returns:
        the true value of max items to return, this will be <= 0 to indicate returning all items
      • getTotalItemsMatched

        public int getTotalItemsMatched()
      • getStartNum

        public int getStartNum()
        Returns:
        the starting number for these results (starts at 1)
      • getEndNum

        public int getEndNum()
        Returns:
        the ending number for these results (this is the true ending number and also the ending index based on the items returned and not only based on the max items to return)
      • getResultsNum

        public int getResultsNum()
        Returns:
        the count of the number of items returned
      • getPerPageNum

        public int getPerPageNum()
      • getPagesNum

        public int getPagesNum()
      • getTotalNum

        public int getTotalNum()
        Returns:
        the count of the total number of items found
      • setOriginalQuery

        public void setOriginalQuery​(String originalQuery)
      • getOriginalQuery

        public String getOriginalQuery()
      • setItemsPerPage

        public void setItemsPerPage​(int itemsPerPage)
      • getItemsPerPage

        public int getItemsPerPage()