As an update, calling ThinkingSphinx::Search#search_for_ids works fine.

>> ThinkingSphinx::Search.search_for_ids "membername"
=> [3]

Whereas calling User#search_for_ids doesn't work properly (unless
User.find(3) or another #find call with 3 among the results has been called
before).

>> User.search_for_ids "membername"
=> []

Any ideas?

On Fri, Dec 26, 2008 at 5:13 AM, Alex Caudill <[email protected]> wrote:

> Please ignore the inconsistent User/Individual class names, I was trying to
> simplify the examples and probably ended up making it a bit more
> confusing...
>
> Long story short, I need to have done a successful #find on any given model
> instance before ThinkingSphinx will successfully return it with #search.
>
> On Fri, Dec 26, 2008 at 4:50 AM, Alex <[email protected]> wrote:
>
>>
>> Hi,
>>
>> Firstly, thinking sphinx is great ;)
>>
>> I'm having some trouble working with it in development mode. Here's
>> the behavior I'm getting:
>>
>> a...@railsdev:~/myproject$ script/console
>> Loading development environment (Rails 2.2.2)
>> >> User.search :conditions => { :member => "membername" }
>> => []
>>
>> Initially the search returns nothing, which is weird, because I know
>> membername exists. Let's confirm this.
>>
>> >> User.find_by_name("erudified")
>> => #<User id: 3, email: "mem...@member", name: "membername",
>> (attributes chopped for brevity)>
>>
>> >> User.find(:all)
>> (bunch of users)
>>
>> And now after calling User.find(:all) (or simply #find_by_name, either
>> works) in development mode, User#search works as expected...
>>
>> >> User.search :conditions => { :member => "erudified" }
>> => [#<Individual id: 3, email: "mem...@member", name: "membername",
>> (attributes chopped for brevity)>]
>>
>> How can I prevent this behavior? Any advice would be appreciated!
>>
>> >>
>>
>

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