Right -- I suppose I was more curious why my sphinx_scope responded to
find() in the first place.  Oh well.

As for the all() method not working, I give up.  The logs show nothing
unusual.

On Jul 21, 8:01 pm, Pat Allan <[email protected]> wrote:
> Hi Kyle
>
> Thinking Sphinx doesn't actually implement find, and find is a SQL method, 
> whereas sphinx scopes are for Sphinx. Which means you can't mix and match - 
> this is the reason I added sphinx scopes, because normal named scopes aren't 
> Sphinx-friendly.
>
> No idea about the all method not working... what does the log show after 
> creating the new object initially, then running Item.all.include?(item)?
>
> Cheers
>
> --
> Pat
>
> On 22/07/2010, at 6:08 AM, Kyle Fox wrote:
>
>
>
> > It appears ThinkingSphinx's `find()` method works differently on
> > sphinx_scopes than expected (and is undocumented):
>
> > Item.find(1)
> > => #<Item id: 1 ... >
>
> > Item.my_sphinx_scope.find(1)
> > => #<Enumerable::Enumerator:0x1076842c0>
>
> > Again, is this the intended behaviour?  IMO it would be much cleaner
> > if ThinkingSphinx's API was as similar as possible to ActiveRecord's
> > when using methods of the same name.
>
> > On Jul 21, 11:28 am, Kyle Fox <[email protected]> wrote:
> >> I'm seeing odd behaviour in models with a sphinx index (models without
> >> an index appear to be unaffected).  The `.all` class method behaves
> >> funny from the console -- it doesn't include instances created during
> >> that session.  Stopping and restarting the console fixes the behaviour
> >> (rebuilding the index has no effect).  I'm wondering if this is
> >> normal.
>
> >> Here's an example to illustrate:
>
> >> item = Item.create(params)
> >> => #<Item id: 1 ... >
>
> >> Item.all.length
> >> => 1
>
> >> Item.all.include?(item)
> >> => false
>
> >> Item.find(item.id)
> >> => #<Item id: 1 ... >
>
> >> --- Exit & open a new console session ---
>
> >> item = Item.find(item.id)
> >> => #<Item id: 1 ... >
>
> >> Item.all.include?(item)
> >> => true
>
> >> Any insight would be appreciated -- thanks!
>
> > --
> > 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 
> > athttp://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