What are the results for the following:

  Model.search :with => {:sphinx_internal_id => 36609}

It's worth noting that the first column returned in the generated SQL for 
Sphinx is also called id - but it's the primary key with an offset and 
multiplier, to ensure Sphinx ids are unique across *all* indices. For the 
purpose of translating Sphinx results back into ActiveRecord results, there's 
an internal attribute called sphinx_internal_id which *is* the primary key.

Generally, I'd recommend either using sphinx_internal_id, or giving your own 
attribute an alias to ensure it doesn't conflict:

  has id, :as => :model_id

Of course, if the search still isn't returning the right results, then the 
problem must be something else. Let me know :)

-- 
Pat

On 11 Jul 2014, at 3:03 pm, mikej <[email protected]> wrote:

> I have a rails app in production and development using the same db.
> 
> When I run in rails console
> 
> Model.search nil,:with => {:id=>[36609]}
> 
> Development Results
> 
> Model with id of 36609
> 
> Production Results
> 
> Model with id of 12203
> 
> The production version is worrying.  I've tried deleting 
> production.sphinx.conf and binlog dir and running configure/rebuild.  Still 
> the odd results persists.
> 
> Using thinking-sphinx (3.1.0)
> 
> 
> Sphinx 2.0.8 in production
> 
> 
> Sphinx 2.0.6 in development
> 
> Index:
> 
> 
> 
> ThinkingSphinx::Index.define :model, :with => :active_record, :delta => true 
> do
> 
> ... 
> 
>  has :id
> 
> ....
> 
> end
> 
> 
> 
> Any ideas anyone?
> 
> Many thanks,
> 
> 
> 
> Mike
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to