Interface TotalHitsAwareCollector

public interface TotalHitsAwareCollector

Interface to allow classes that extend 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,, com.atlassian.jira.web.bean.PagerFilter) LuceneSearchProvider.searchAndSort(com.atlassian.query.Query, com.atlassian.crowd.embedded.api.User,, com.atlassian.jira.web.bean.PagerFilter) LuceneSearchProvider.searchAndSortOverrideSecurity(com.atlassian.query.Query, com.atlassian.crowd.embedded.api.User,, com.atlassian.jira.web.bean.PagerFilter) LuceneSearchProvider.searchAndSortOverrideSecurity(com.atlassian.query.Query, com.atlassian.jira.user.ApplicationUser,, 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.


Method Summary
 void setTotalHits(int totalHits)
          Set the total hits.

Method Detail


void setTotalHits(int totalHits)
Set the total hits. This may be larger than 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 -

Copyright © 2002-2014 Atlassian. All Rights Reserved.