Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

javadoc questions/inconsistencies

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


cristian.vat at gmail

Nov 17, 2009, 1:32 AM

Post #1 of 2 (411 views)
Permalink
javadoc questions/inconsistencies

Hello all,

Sorry if this is offtopic or already discussed/documented somewhere.

Regarding lucene 2.9.1 javadoc:

In Searcher the method "TopDocs search(Query query, int n)" says "Finds the
top n hits for query."
However if I do a search(someQuery, 100) which gets me 1000 results all
results are available, so it doesn't actually limit the hit count to N.

What I saw from the code is that the N is actually the initial size of a
PriorityQueue, but which gets expanded dynamically. So actually the N
doesn't limit anything.
(My initial case, although I might be the only one doing that, was that I
wanted all results so I put an absurdly large number as N. All I got of
course was slower searches because a bigger priority queue had to be
initialized).

-
Cristian Vat


uwe at thetaphi

Nov 17, 2009, 1:37 AM

Post #2 of 2 (397 views)
Permalink
RE: javadoc questions/inconsistencies [In reply to]

The PriorityQueue is fixed size, it cannot grow (please note, it is *not*
Java's PQ, ist an own one!).

TopDocs will contain only n documents in it's scoreDocs array, the reported
total hit count will return all matches!

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe [at] thetaphi

> -----Original Message-----
> From: Cristian Vat [mailto:cristian.vat [at] gmail]
> Sent: Tuesday, November 17, 2009 10:33 AM
> To: java-user [at] lucene
> Subject: javadoc questions/inconsistencies
>
> Hello all,
>
> Sorry if this is offtopic or already discussed/documented somewhere.
>
> Regarding lucene 2.9.1 javadoc:
>
> In Searcher the method "TopDocs search(Query query, int n)" says "Finds
> the
> top n hits for query."
> However if I do a search(someQuery, 100) which gets me 1000 results all
> results are available, so it doesn't actually limit the hit count to N.
>
> What I saw from the code is that the N is actually the initial size of a
> PriorityQueue, but which gets expanded dynamically. So actually the N
> doesn't limit anything.
> (My initial case, although I might be the only one doing that, was that I
> wanted all results so I put an absurdly large number as N. All I got of
> course was slower searches because a bigger priority queue had to be
> initialized).
>
> -
> Cristian Vat


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.