lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Israel Tsadok <itsa...@gmail.com>
Subject Re: TopDocsCollector and sorting
Date Wed, 16 Mar 2011 06:20:35 GMT
TopDocsCollector.topDocs() does return the results sorted, by score. It
basically returns a slice of a PriorityQueue.
You can take a look at the
source<http://svn.apache.org/repos/asf/lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/TopDocsCollector.java>,
it's one of the easier parts of the code.

On Wed, Mar 16, 2011 at 2:48 AM, Ryan Aylward <ryan@glassdoor.com> wrote:

> Does the TopDocsCollector sort the docs it returns?
>
> The java doc for...
>
> public final TopDocs topDocs(int start)
>
> states....
>
> Returns the documents in the range [start .. pq.size()) that were collected
> by this collector. Note that if start >= pq.size(), an empty TopDocs is
> returned.
> This method is convenient to call if the application always asks for the
> last results, starting from the last 'page'.
>
> So it returns the proper results for a given page, but it is not clear that
>  it sorts the results for that page.
>
> I would have thought it does sort the results for the returned docs, but
> I'm seeing some results that show that the results are not sorted.
>
> Thanks,
> Ryan
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message