On 1/10/06, Vamsee K. [email protected] wrote:
I’m guessing the ‘=>50’ after search_each indicates that there are 50 documents returned. How come I can only see 10 in the array res?
If you look at Index::Index’s search_each method you’ll see it calls
do_search internally, which in turn calls Search::IndexSearcher’s
search method. This search method takes an options hash which accepts
the following keys:
# filter:: filters docs from the search result
# first_doc:: The index in the results of the first doc retrieved.
# Default is 0
# num_docs:: The number of results returned. Default is 10
# sort:: An array of SortFields describing how to sort the
So it is returning 10 docs due to the fact that num_docs defaults to 10.
I’ve been waiting for David to return to bring this up again, but I
think this code should be moved out of Search::IndexSearcher into
Index::Index and that there should be a Hits class a la Java Lucene to
manage the hits returned.