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: u...@thetaphi.de > -----Original Message----- > From: Cristian Vat [mailto:cristian....@gmail.com] > Sent: Tuesday, November 17, 2009 10:33 AM > To: java-user@lucene.apache.org > 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-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org