Class SearchResults
- java.lang.Object
-
- 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
Fields Modifier and Type Field Description intitemsPerPagefor paging the resultsintmaxItemsToReturnThe maximum number of results returned after the startindex, 0 indicates the default value (all items)StringoriginalQueryThis is a holder for the original query before it is adjustedStringqueryThe search query that was performedintstartIndexThe index (position) of the result item to started on (used for paging)
0 indicates the default value (start at the beginning)inttotalItemsMatchedThe total number of items matched by the search
-
Constructor Summary
Constructors Constructor Description SearchResults()SearchResults(int start, int max, int total, List<SearchResult> results)use this constructor to build search results manuallySearchResults(String query, int startIndex, int maxItemsToReturn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddResult(SearchContent content)Add results to the total results, this will not allow adding results beyond the totalItemsMatched (max) numberbooleanaddResult(SearchResult searchResult)Add results to the total results, this will not allow adding results beyond the maxItemsToReturn (max) numberintgetEndIndex()intgetEndNum()intgetItemsPerPage()intgetMaxItemsToReturn()StringgetOriginalQuery()intgetPagesNum()intgetPerPageNum()StringgetQuery()List<SearchResult>getResults()intgetResultsNum()intgetStartIndex()intgetStartNum()intgetTotalItemsMatched()intgetTotalNum()voidsetItemsPerPage(int itemsPerPage)voidsetOriginalQuery(String originalQuery)
-
-
-
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()
-
-