Class DefaultSearchResults
- java.lang.Object
-
- com.atlassian.confluence.search.v2.DefaultSearchResults
-
- All Implemented Interfaces:
SearchResults
,Iterable<SearchResult>
- Direct Known Subclasses:
LuceneSearchResults
public class DefaultSearchResults extends Object implements SearchResults
Default implementation of SearchResults- Since:
- 5.9
-
-
Field Summary
Fields Modifier and Type Field Description protected static SearchResults
EMPTY_RESULTS
-
Constructor Summary
Constructors Constructor Description DefaultSearchResults(List<? extends SearchResult> results, int unfilteredResultsCount)
DefaultSearchResults(List<? extends SearchResult> results, int unfilteredResultsCount, SearchWithToken nextPageSearch, List<String> searchWords)
DefaultSearchResults(List<? extends SearchResult> results, int unfilteredResultsCount, SearchWithToken nextPageSearch, List<String> searchWords, String searchQuery)
DefaultSearchResults(List<? extends SearchResult> results, int unfilteredResultsCount, String searchQuery)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<SearchResult>
getAll()
Creates a new list containing all returned search results.SearchWithToken
getNextPageSearch()
List
getRawResults()
Get the raw search results.String
getSearchQuery()
List<String>
getSearchWords()
int
getUnfilteredResultsCount()
Get the number of search results before being passed through any filter.boolean
isLastPage()
Iterator<SearchResult>
iterator()
Gets an iterator to run through the returned search results.int
size()
Get the number of search results included in this object.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
EMPTY_RESULTS
protected static final SearchResults EMPTY_RESULTS
-
-
Constructor Detail
-
DefaultSearchResults
public DefaultSearchResults(List<? extends SearchResult> results, int unfilteredResultsCount, String searchQuery)
-
DefaultSearchResults
public DefaultSearchResults(List<? extends SearchResult> results, int unfilteredResultsCount)
-
DefaultSearchResults
public DefaultSearchResults(List<? extends SearchResult> results, int unfilteredResultsCount, SearchWithToken nextPageSearch, List<String> searchWords)
-
DefaultSearchResults
public DefaultSearchResults(List<? extends SearchResult> results, int unfilteredResultsCount, SearchWithToken nextPageSearch, List<String> searchWords, String searchQuery)
-
-
Method Detail
-
getRawResults
public List getRawResults()
Get the raw search results. Mostly necessary for testing, don't call this directly!- Returns:
- the raw search results.
-
getUnfilteredResultsCount
public int getUnfilteredResultsCount()
Get the number of search results before being passed through any filter. (i.e. to get the total number of results before taking only the first ten)- Specified by:
getUnfilteredResultsCount
in interfaceSearchResults
- Returns:
- the number of search results before filtering takes place
-
size
public int size()
Description copied from interface:SearchResults
Get the number of search results included in this object.- Specified by:
size
in interfaceSearchResults
- Returns:
- the number of search results returned
-
iterator
public Iterator<SearchResult> iterator()
Description copied from interface:SearchResults
Gets an iterator to run through the returned search results.- Specified by:
iterator
in interfaceIterable<SearchResult>
- Specified by:
iterator
in interfaceSearchResults
- Returns:
- an iterator over the search results
-
getAll
public List<SearchResult> getAll()
Description copied from interface:SearchResults
Creates a new list containing all returned search results.- Specified by:
getAll
in interfaceSearchResults
- Returns:
- a new list containing all returned search results
-
getSearchWords
public List<String> getSearchWords()
- Specified by:
getSearchWords
in interfaceSearchResults
- Returns:
- a list of the words in the query string that were actually used in the search (raw query string with the stop words removed). May be an empty list if there were none.
-
getSearchQuery
public String getSearchQuery()
- Specified by:
getSearchQuery
in interfaceSearchResults
- Returns:
- a query string used in the search. It is useful for diagnostic purpose.
-
getNextPageSearch
public SearchWithToken getNextPageSearch()
- Specified by:
getNextPageSearch
in interfaceSearchResults
- Returns:
- a ISearch that can be used to retrieve the next page of results.
-
isLastPage
public boolean isLastPage()
- Specified by:
isLastPage
in interfaceSearchResults
- Returns:
- true if this is the last page of search results.
-
-