Looks like a bug to me... although the :classes behaviour limits which indexes 
are used, not which subclasses (though ideally it should do both).

As a work-around, try the following:
  ThinkingSphinx.search('britcey',
    :with => {:class_crc => [AuditLog.to_crc32, SoftwareAuditLog.to_crc32]}
  ).total_entries

-- 
Pat

On 31/03/2010, at 7:56 AM, ritcey wrote:

> Hi all,
> 
> I've got STI models like this:
> 
> class Log < ActiveRecord::Base
>  belongs_to :asset
>  belongs_to :user
>  belongs_to :author, :class_name => "User", :foreign_key
> => :author_id
> 
>  define_index do
>    indexes message
>    has id, author_id, user_id, asset_id, created_at
>    set_property :delta => :delayed
>  end
> end
> 
> class AuditLog < Log
> end
> class IpAuditLog < Log
> end
> class SoftwareAuditLog < Log
> end
> 
> When calling TS w/ the :classes argument (to limit to certain
> subclasses of Log), the total_entries numbers are coming up wrong:
> 
>>> ThinkingSphinx.version
> => "1.3.16"
>>> ThinkingSphinx.search('britcey').total_entries
> => 5512
>>> ThinkingSphinx.search('britcey', :classes => [AuditLog]).total_entries
> => 5512
>>> ThinkingSphinx.search('britcey', :classes => [AuditLog, 
>>> SoftwareAuditLog]).total_entries
> => 10024
>>> ThinkingSphinx.search('britcey', :classes => [AuditLog, SoftwareAuditLog, 
>>> IpAuditLog]).total_entries
> => 14536
> 
> Am I doing something wrong or did I find a bug?
> 
> Thanks much,
> 
> -b
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/thinking-sphinx?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to