Hi Oli

The issue is probably related to what version of Rails you're using  
(and how long ago you installed Thinking Sphinx).

To make STI searches work correctly, Thinking Sphinx forcefully loads  
every model when the rails app is started - but this process hasn't  
always been in place, and sometimes isn't so friendly for older Rails  
versions.

To make sure everything's happening as expected, might be best to add  
the following line to the bottom of your environment.rb file:
ThinkingSphinx::Configuration.instance.load_models

Cheers

-- 
Pat

On 22/12/2008, at 11:08 AM, Oli wrote:

>
> Hi Y'all
>
> Thanks for all the work done so far, TS is an elegant solution to a
> ratty problem
>
> So my issue, we have an STI structure
>
> State -> Town -> Suburb
>
> and these models all inherit from the a Location model. Structurally
> everything works fine, it covers the business logic well and
> everything is happy, except TS ... this is how it pans out ... most
> interesting is the two calls to Location.search, first time it's
> empty, last time it's a combination of the two STI classes
>
>>> Location.search("adelaide")
> => []
>
>>> ThinkingSphinx::Search.search "adelaide"
> NoMethodError: You have a nil object when you didn't expect it!
> The error occurred while evaluating nil.constantize
> from /Users/oli/Code/work/GaggleBox/Code/trunk/vendor/plugins/
> thinking_sphinx/lib/thinking_sphinx/collection.rb:66:in
> `class_from_crc'...
>
>>> Town.search("adelaide")
> => [#<Town id: 43753, parent_id: 36861, locale_id: nil, currency_id:
> nil, name: "Brunswick And Adelaide", slug: "brunswick-and-adelaide",
> type: "Town", code: nil, timezone: nil, postcode: nil, longitude: nil,
> latitude: nil, created_at: "2008-10-16 01:27:58", updated_at:
> "2008-10-16 01:27:58", accuracy: nil>]
>
>>> Suburb.search("adelaide")
> => [#<Suburb id: 45515, parent_id: 11, locale_id: nil, currency_id:
> nil, name: "Adelaide River", slug: "adelaide-river", type: "Suburb",
> code: nil, timezone: nil, postcode: "0846", longitude: nil, latitude:
> nil, created_at: "2008-10-16 06:09:13", updated_at: "2008-10-16
> 06:09:13", accuracy: nil> ..... + more
>
>>> Location.search("adelaide")
> => [#<Town id: 43753, parent_id: 36861, locale_id: nil, currency_id:
> nil, name: "Brunswick And Adelaide", slug: "brunswick-and-adelaide",
> type: "Town", code: nil, timezone: nil, postcode: nil, longitude: nil,
> latitude: nil, created_at: "2008-10-16 01:27:58", updated_at:
> "2008-10-16 01:27:58", accuracy: nil>, #<Suburb id: 45515, parent_id:
> 11, locale_id: nil, currency_id: nil, name: "Adelaide River", slug:
> "adelaide-river", type: "Suburb", code: nil, timezone: nil, postcode:
> "0846", longitude: nil, latitude: nil, created_at: "2008-10-16
> 06:09:13", updated_at: "2008-10-16 06:09:13", accuracy: nil>, ...... +
> more
>
> Any suggestions?
>
> >


--~--~---------~--~----~------------~-------~--~----~
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