You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by haipeng du <ha...@gmail.com> on 2005/09/07 17:57:45 UTC

limit lucene result

The reason that I want to limit returned result is that I do not want
to get out of memory problem. I index lucene with 3 million documents.
Sometimes, searching will return millions of fields back to me. I just
want to get the first 100, for example , to show them to user. Even, I
use search(query,filter,topDocs), I believe it still return all results
back. So how could I limit the lucene returning?

-- 
Haipeng Du
Software Engineer
Comphealth, 
Salt Lake City

Re: limit lucene result

Posted by Yonik Seeley <ys...@gmail.com>.
The Hits object retrieves the documents lazily, so just ask it for the first 
100.

-Yonik

On 9/7/05, haipeng du <ha...@gmail.com> wrote:
> 
> The reason that I want to limit returned result is that I do not want
> to get out of memory problem. I index lucene with 3 million documents.
> Sometimes, searching will return millions of fields back to me. I just
> want to get the first 100, for example , to show them to user. Even, I
> use search(query,filter,topDocs), I believe it still return all results
> back. So how could I limit the lucene returning?
> 
> --
> Haipeng Du
> Software Engineer
> Comphealth,
> Salt Lake City
> 
> 


-- 
-Yonik
Now hiring -- http://tinyurl.com/7m67g