Hi, I'm having some trouble with ferret search_each. I'm posting rails' script/console output, so I guess you can decrypt it: >> res =  =>  >> index.search_each('name: a*') do |doc, score| ?> res << doc >> end => 50 >> res.size => 10 >> 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? Thanks much, Vamsee.
on 2006-01-10 09:23
on 2006-01-10 17:38
On 1/10/06, Vamsee K. <firstname.lastname@example.org> 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 results. 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. -F