Patrick,
The TopDocs() method on a TopDocCollector will return a TopDocs
object, which has a ScoreDocs method that will return an array of
ScoreDocs that contain two properties, one of the document id and the
other of the score. This array is sorted by score in descending order.
Unless you are have some special needs you may not need to inherit
from a TopDocCollector, but instead use the Searcher(Query, Filter,
int) method that returns a TopDocs object.
Cheers,
Michael
On Jun 16, 2007, at 6:14 PM, Patrick Burrows wrote:
Is there some documentation somewhere, or an explanation, or a sample,
of how to use the TopDocCollector?
I do this:
Query qry = q.Parse(query);
TopDocCollector tdc = new TopDocCollector(1000);
searcher.Search(qry, tdc);
tdc.Collect(100,5);
...and then what? How do I retreive the TopDocs that were just
collected? I don't see any properties of the collector that contain an
array of docs. I don't see any methods that return an array of docs.
I must be missing something obvious... but whatever it is, it is
elluding me.
--
-
P