com.atlassian.jira.issue.search.TotalHitsAwareCollector |
@Internal
or @PublicApi
.
Interface to allow classes that extend Collector to be informed of the total number of hits.
This is only recognised by the LuceneSearchProvider
methods
searchAndSort(com.atlassian.query.Query, com.atlassian.jira.user.ApplicationUser, org.apache.lucene.search.Collector, com.atlassian.jira.web.bean.PagerFilter)
searchAndSort(com.atlassian.query.Query, com.atlassian.crowd.embedded.api.User, org.apache.lucene.search.Collector, com.atlassian.jira.web.bean.PagerFilter)
searchAndSortOverrideSecurity(com.atlassian.query.Query, com.atlassian.crowd.embedded.api.User, org.apache.lucene.search.Collector, com.atlassian.jira.web.bean.PagerFilter)
searchAndSortOverrideSecurity(com.atlassian.query.Query, com.atlassian.jira.user.ApplicationUser, org.apache.lucene.search.Collector, com.atlassian.jira.web.bean.PagerFilter)
If you wish to search for the top 500 results, but also know the total hits.
collector = new MyCollector() // Implementing TotalHitsAwareCollector
PagerFilter filter = new PagerFilter(1, 500);
searchProvider.searchAndSort(parseResult.getQuery(), user, collector, filter);
This will call setTotalHits(int x) on your collector.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Set the total hits.
|
Set the total hits.
This may be larger than getMax()
requested when the search is invoked.
There is no ordering guarenteed between calls to this method and calls to collect(int)
.
This method will be called even if collect() is not (e.g. there are no results).