@ExperimentalApi public interface

TotalHitsAwareCollector

com.atlassian.jira.issue.search.TotalHitsAwareCollector

@ExperimentalApi

This interface is considered usable by external developers but its contracts have not stabilized.

Experimental APIs may be changed at any time before being marked @Internal or @PublicApi.

Class Overview

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.

Summary

Public Methods
void setTotalHits(int totalHits)
Set the total hits.

Public Methods

public void setTotalHits (int totalHits)

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