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 neeraj shah <ne...@gmail.com> on 2013/06/19 09:11:19 UTC
how to reterieve all results from lucene searcher.search() method
hello,
Is there any way to get all the search result.
In lucene we get top documents by giving the limit like top 100,1000... etc.
but if i want to get all results.
How can I achieve that??
Query qu = new QueryParser(Version.LUCENE_36,"field",
analyzer).parse(query);
TopDocs hits = searcher.search(qu,1000);
Re: how to reterieve all results from lucene searcher.search() method
Posted by neha yadav <ne...@gmail.com>.
You can try like :
long docSizeQ1= docs.getNumFound() ;
will give you the total number of results.
and this value can be inserted in
like
TopDocs hits = searcher.search(qu,docSizeQ1);
Hope this helps.
On Wed, Jun 19, 2013 at 1:09 PM, Swapnil Patil <pi...@gmail.com>wrote:
> you can get all results for given query "q". By giving documents to fetch
> a very big number like Integer.MAX_VALUE.
>
> But if u want to loop over all documents. Use index reader and get
> document by its doc id from 0 to numDocs (Index reader has method for num
> docs).
>
>
> On Wed, Jun 19, 2013 at 3:11 PM, neeraj shah <ne...@gmail.com>
> wrote:
>
> > hello,
> >
> > Is there any way to get all the search result.
> > In lucene we get top documents by giving the limit like top 100,1000...
> > etc.
> > but if i want to get all results.
> >
> > How can I achieve that??
> >
> > Query qu = new QueryParser(Version.LUCENE_36,"field",
> > analyzer).parse(query);
> >
> > TopDocs hits = searcher.search(qu,1000);
> >
>
Re: how to reterieve all results from lucene searcher.search() method
Posted by Michael McCandless <lu...@mikemccandless.com>.
Create a custom Collector?
Mike McCandless
http://blog.mikemccandless.com
On Wed, Jun 19, 2013 at 3:39 AM, Swapnil Patil <pi...@gmail.com> wrote:
> you can get all results for given query "q". By giving documents to fetch
> a very big number like Integer.MAX_VALUE.
>
> But if u want to loop over all documents. Use index reader and get
> document by its doc id from 0 to numDocs (Index reader has method for num
> docs).
>
>
> On Wed, Jun 19, 2013 at 3:11 PM, neeraj shah <ne...@gmail.com> wrote:
>
>> hello,
>>
>> Is there any way to get all the search result.
>> In lucene we get top documents by giving the limit like top 100,1000...
>> etc.
>> but if i want to get all results.
>>
>> How can I achieve that??
>>
>> Query qu = new QueryParser(Version.LUCENE_36,"field",
>> analyzer).parse(query);
>>
>> TopDocs hits = searcher.search(qu,1000);
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: how to reterieve all results from lucene searcher.search() method
Posted by Swapnil Patil <pi...@gmail.com>.
you can get all results for given query "q". By giving documents to fetch
a very big number like Integer.MAX_VALUE.
But if u want to loop over all documents. Use index reader and get
document by its doc id from 0 to numDocs (Index reader has method for num
docs).
On Wed, Jun 19, 2013 at 3:11 PM, neeraj shah <ne...@gmail.com> wrote:
> hello,
>
> Is there any way to get all the search result.
> In lucene we get top documents by giving the limit like top 100,1000...
> etc.
> but if i want to get all results.
>
> How can I achieve that??
>
> Query qu = new QueryParser(Version.LUCENE_36,"field",
> analyzer).parse(query);
>
> TopDocs hits = searcher.search(qu,1000);
>