org.sakaiproject.entitybroker.entityprovider.extension
Class SearchResults

java.lang.Object
  extended by org.sakaiproject.entitybroker.entityprovider.extension.SearchResults

public class SearchResults
extends Object

This represents the return data from a search

Author:
Aaron Zeckoski (azeckoski @ gmail.com)

Field Summary
 int itemsPerPage
          for paging the results
 int maxItemsToReturn
          The maximum number of results returned after the startindex, 0 indicates the default value (all items)
 String originalQuery
          This is a holder for the original query before it is adjusted
 String query
          The search query that was performed
 int startIndex
          The index (position) of the result item to started on (used for paging)
0 indicates the default value (start at the beginning)
 int totalItemsMatched
          The total number of items matched by the search
 
Constructor Summary
SearchResults()
           
SearchResults(int start, int max, int total, List<SearchResult> results)
          use this constructor to build search results manually
SearchResults(String query, int startIndex, int maxItemsToReturn)
           
 
Method Summary
 boolean addResult(SearchContent content)
          Add results to the total results, this will not allow adding results beyond the totalItemsMatched (max) number
 boolean addResult(SearchResult searchResult)
          Add results to the total results, this will not allow adding results beyond the maxItemsToReturn (max) number
 int getEndIndex()
           
 int getEndNum()
           
 int getItemsPerPage()
           
 int getMaxItemsToReturn()
           
 String getOriginalQuery()
           
 int getPagesNum()
           
 int getPerPageNum()
           
 String getQuery()
           
 List<SearchResult> getResults()
           
 int getResultsNum()
           
 int getStartIndex()
           
 int getStartNum()
           
 int getTotalItemsMatched()
           
 int getTotalNum()
           
 void setItemsPerPage(int itemsPerPage)
           
 void setOriginalQuery(String originalQuery)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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()

getResults

public List<SearchResult> getResults()

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()


Copyright © 2007-2012 Sakai Project. All Rights Reserved.