# \[AAF\] Odd total\_hits situation

**URL:** <https://www.ruby-forum.com/t/aaf-odd-total-hits-situation/109502>\
**Category:** Rails\
**Created:** [July 16, 2007, 1:29am UTC](https://www.ruby-forum.com/t/aaf-odd-total-hits-situation/109502 "2007-07-16T01:29:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iceninejon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/9fc348/32.png) [@iceninejon](https://www.ruby-forum.com/u/iceninejon)\
**Post date:** [July 16, 2007, 1:29am UTC](https://www.ruby-forum.com/t/aaf-odd-total-hits-situation/109502/1 "2007-07-16T01:29:53Z")

</div>

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  
[Ferret Pagination in Rails - igvita.com](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)?
