I''m fairly new to RoR so go easy please :). I''m having a
situation
where I''m using acts_as_ferret and getting odd results. I''m
trying to
implement pagination described at
http://www.igvita.com/blog/2007/02/20/ferret-pagination-in-rails/ but
the count of the number of results appears incorrect.
I have a model called Bookmark which contains 31 records. In the
console, if I enter:
count = Bookmark.find_by_contents("yahoo OR work OR google",
:conditions
=> [''private = ?'', 0], :group =>
"url").total_hits
I receive "5" as the response. With the conditions and grouping, the
correct number of results should be 3.
If I then enter:
res = Bookmark.find_by_contents("yahoo OR work OR google", {:offset
=>
0, :limit => 10}, :conditions => [''private = ?'', 0],
:group => "url")
I receive "3" as the response (the correct number). It looks like if
I
specify the offset and limit, I get the correct number of results and if
I leave it out of the query, I receive the number of results I would
receive if the :conditions and :group were ignored. On the second
query, if I change the limit to something larger than 10 (100000 for
example), I still receive the correct number of results.
Can anyone think of a reason for this (am I doing something
incorrectly)?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---