Forum: Ferret Could not get all matched docs

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
58b625666c15587340fe91b780cca709?d=identicon&s=25 Donghui Wen (dhwen)
on 2006-05-26 23:24
Hi,
   I used Ferret to build an index and try to search here.
But it looks like it always return only 10 matches results,
event the return number of search_each is more than 10.
Did I do something wrong?
------------------

n = index.search_each("ruby") do |doc, score|
  puts index[doc]['file']
end

print n

------------------

I can only see 10 lines' output.
But n is 214 in the case.

Thanks in advance for your help!

Donghui
58b625666c15587340fe91b780cca709?d=identicon&s=25 Donghui Wen (dhwen)
on 2006-05-27 00:07
Ok, I just figured it out, I need to add the num_docs parameter:

 index.search_each('content:"NetScreen"', :num_docs=> 200


Donghui

Donghui Wen wrote:
> Hi,
>    I used Ferret to build an index and try to search here.
> But it looks like it always return only 10 matches results,
> event the return number of search_each is more than 10.
> Did I do something wrong?
> ------------------
>
> n = index.search_each("ruby") do |doc, score|
>   puts index[doc]['file']
> end
>
> print n
>
> ------------------
>
> I can only see 10 lines' output.
> But n is 214 in the case.
>
> Thanks in advance for your help!
>
> Donghui
This topic is locked and can not be replied to.