On Sun, Feb 19, 2012 at 9:21 AM, Benson Margulies <bimargul...@gmail.com> wrote: > If I have a lot of segments, and an executor service in my searcher, > the following runs out of memory instantly, building giant heaps. Is > there another way to express this? Should I file a JIRA that the > parallel code should have some graceful behavior? > > int longestMentionFreq = searcher.search(longestMentionQuery, filter, > Integer.MAX_VALUE).totalHits + 1; >
the _n_ you pass there is the actual number of results that you need to display to the user, in top-N order. so in most cases this should be something like 20. This is because it builds a priority queue of size _n_ to return results in sorted order. Don't pass huge numbers here: if you are not actually returning pages of results to the user, but just counting hits, then pass TotalHitCountCollector. -- lucidimagination.com --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org