@ExperimentalApi
public interface TotalHitsAwareCollector
Collector to be informed of the total number of hits.
This is only recognised by the LuceneSearchProvider methods
LuceneSearchProvider.searchAndSort(com.atlassian.query.Query, com.atlassian.jira.user.ApplicationUser, org.apache.lucene.search.Collector, com.atlassian.jira.web.bean.PagerFilter)
com.atlassian.jira.issue.search.providers.LuceneSearchProvider#searchAndSort(com.atlassian.query.Query, com.atlassian.crowd.embedded.api.User, org.apache.lucene.search.Collector, com.atlassian.jira.web.bean.PagerFilter)
com.atlassian.jira.issue.search.providers.LuceneSearchProvider#searchAndSortOverrideSecurity(com.atlassian.query.Query, com.atlassian.crowd.embedded.api.User, org.apache.lucene.search.Collector, com.atlassian.jira.web.bean.PagerFilter)
LuceneSearchProvider.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.
| Modifier and Type | Method and Description |
|---|---|
default int |
getTotalHits()
Get the total hits.
|
void |
setTotalHits(int totalHits)
Set the total hits.
|
void setTotalHits(int totalHits)
PagerFilter.getMax() requested when the search is invoked.
There is no ordering guarenteed between calls to this method and calls to Collector.collect(int).
This method will be called even if collect() is not (e.g. there are no results).totalHits - default int getTotalHits()
Copyright © 2002-2017 Atlassian. All Rights Reserved.