pat / thinking-sphinx

Sphinx/Manticore plugin for ActiveRecord/Rails
http://freelancing-gods.com/thinking-sphinx
MIT License
1.63k stars 468 forks source link

How to skip STI filter? #297

Closed releu closed 12 years ago

releu commented 12 years ago

I am on rails 3.1.1 and have STI models.

class A < ActiveRecord::Base
  define_index 'foo' do
    # ...
  end
end

class B < A
end

When I B.search 'booo' then I get record B. When I A.search 'booo' then I should get record B, but I got [].

What should I do to resolve this problem?

Used TS 2.0.5.

Sorry for my English.

pat commented 12 years ago

Hi Jan

Can you tell me the file paths for your STI models? Are they both in the root of app/models? Or elsewhere? eg:

app/models/a.rb
app/models/b.rb
releu commented 12 years ago

Yes. It is deal.rb and fix_price_deal.rb and other...

The indexes definded in deal.rb.

If I Deal.search 'booo', :condition => { :with => { :class_crc => [FixPriceDeal.to_crc32] } }, I've got the results.

pat commented 12 years ago

Hi Jan

Sorry for the slow reply - can you just confirm for me which versions of Rails and Thinking Sphinx you're using? I'll try to get this sorted as soon as possible.

Thanks

Pat

On 25/10/2011, at 9:56 PM, Jan Bernacki wrote:

Yes. It is deal.rb and fix_price_deal.rb and other...

The indexes definded in deal.rb.

If I Deal.search 'booo', :condition => { :with => { :class_crc = [FixPriceDeal.to_crc32] } }, I've got the results.

Reply to this email directly or view it on GitHub: https://github.com/freelancing-god/thinking-sphinx/issues/297#issuecomment-2521381

releu commented 12 years ago

Hi!

ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin11.1.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03

gem 'thinking-sphinx', '2.0.5'

gem 'rails', '3.1.1'

pat commented 12 years ago

Hi Jan

I'm just trying to reproduce this - I'm using 1.8.7 with TS 2.0.5 on Rails 3.1.1, and it all works fine for me. Which version of Sphinx are you using? Can you share the output of rake ts:in?

releu commented 12 years ago

Hi! A cant reproduce this to on new project too. All works ideally. If I catch the bug, I'll post the project repository.