lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Taylor <>
Subject Re: java.lang.NegativeArraySizeException on searching using Integer.MAX_VALUE for number of hits
Date Wed, 02 Dec 2009 15:18:36 GMT
Uwe Schindler wrote:
> If you want to have all results, you do something wrong. :-)
> Full text engines like lucene are made for returning only top-ranking
> results. So if you use TopDocs results you must know before how many TopDocs
> you want to have. Internally Lucene works with PriorityQueues that filter
> the top ranking results.
> If you want to have all results, you should not sort them by ranking, which
> is not needed then). In this case, implement an own Collector and collect
> the results for yourself into e.g. ArrayLists and so on (but they are
> unsorted then).
> Another possibility (if you really need the docs in relevance order) is to
> run the search 2 times:
> First only collect the top n=100 results. The TopDocs instance also returns
> the max results. Using that number you can re-run the query to get all
> ranked results - but this is generally a bad approach, because PQs get
> slower for too many results, where order is not relevant.
Yes thats all fine and is my long term approach, but  isn't there a bug 
here, (in the case that is  failing there is only one actual result ), 
you haven't really addressed why I am geting this exception


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message