Closed pabloalr closed 13 years ago
Are any of the models you've indexed involved in STI setups? I'm wondering if one of your type
columns has NULL values (which Sphinx translates to 0's), instead of the base type.
No STI or polymorphism involved. I forgot to mention, the belongs_to have a counter_cache..
...
belongs_to :owner, :counter_cache => true
...
Okay, I guessed wrong... What version of Sphinx are you using on production, and has that changed recently?
Hi there. I'm running Ruby 1.9.2p180 and Sphinx 2.0.1-beta... everything was working well until I switched to TS 2.0.5.
TS 2.0.5 changes the way classes for search results are tracked with Sphinx 2.0.1 - did you run rake ts:rebuild after upgrading Thinking Sphinx?
(And yes, this isn't documented - so it's my fault).
Yep, Capistrano do a rebuild on every deploy...
I'm not doing pretty well at guessing the cause of this, I'm afraid. Does using edge TS (rails3 branch) work instead of 2.0.5?
Good question! I'm unable to switch right now since I have some users using it, but as soon as possible I'll test it.
It's a very odd behaviour that only happens on production mode... the only difference, besides the production mode, is the server I'm using... nginx instead of Webrick, but I don't think this can influence at all.
On Wed, Aug 17, 2011 at 10:05 AM, freelancing-god < reply@reply.github.com>wrote:
I'm not doing pretty well at guessing the cause of this, I'm afraid. Does using edge TS (rails3 branch) work instead of 2.0.5?
Reply to this email directly or view it on GitHub:
https://github.com/freelancing-god/thinking-sphinx/issues/268#issuecomment-1826103
I've used TS and Sphinx with nginx before, and I know plenty of others do as well, so I very much doubt that's the cause. When you do retry and if the problem still occurs, can you run the following and let me know what the result is?
ThinkingSphinx.search_for_ids(params[:term],
:sort_mode => :expr,
:order => '@weight',
:with => { :owner_id => current_owner.id }
).results[:matches]
Just switched to ts rails3 branch, got the same problem, only when in production mode...
Here goes the output. Please note that the 'owner_id' is actually 'company_id'... I kind of used a pseudo-code on my examples to obfuscate things... :) but the rules are the same, it isn't a polymorphic or STI.
ruby-1.9.2-p180 :006 > ThinkingSphinx.search_for_ids('cassia',
:sort_mode => :expr,
:order => '@weight',
:with => {:company_id => 2}).results[:matches]
=> [{:doc=>669, :weight=>2, :index=>0, :attributes=>{"sphinx_internal_id"=>334,
"sphinx_deleted"=>0, "class_crc"=>1921285768, "sphinx_internal_class"=>0,
"created_at"=>1308855477, "updated_at"=>1310663245,
"company_id"=>2, "@expr"=>2.0}}, {:doc=>544, :weight=>1, :index=>1,
:attributes=>{"sphinx_internal_id"=>272, "sphinx_deleted"=>0,
"class_crc"=>2212487076, "sphinx_internal_class"=>0, "created_at"=>1313005564,
"updated_at"=>1313005594, "company_id"=>2, "@expr"=>1.0}}]
Are you sure you're using Sphinx 2.0.1? The attributes returned don't match what I'm expecting. Do you have anything in your config/sphinx.yml
file?
Yep, Sphinx 2.0.1-beta(r2792).
My config/sphinx.yml only have path for searchd
So I'm going back to my original guess - do you have a type column?
To explain further - if there's a type
column, TS presumes you're using it like Rails does, for STI inheritance, and so sphinx_internal_class uses it to determine the class for search results. It's being returned as 0 in both of the examples above, which means the type
column probably exists but is NULL.
Hi. Sorry the delay...
So, I guess this error should occur also in development mode, right?
Yeah, if you're using the same TS and Sphinx versions, I'd expect to see it there too.
Figured this one out - it worked if you didn't need to set bin_path to locate the Sphinx binaries, but otherwise was making config changes based on the Sphinx version before it was actually determined.
It's now been fixed in both master and rails3 branches.
Thanks! I'll try the new version as soon as possible.
I really had no clue on what was going on...
On Thu, Sep 1, 2011 at 9:05 PM, freelancing-god < reply@reply.github.com>wrote:
Figured this one out - it worked if you didn't need to set bin_path to locate the Sphinx binaries, but otherwise was making config changes based on the Sphinx version before it was actually determined.
It's now been fixed in both master and rails3 branches.
Reply to this email directly or view it on GitHub:
https://github.com/freelancing-god/thinking-sphinx/issues/268#issuecomment-1974775
Hi,
I'm facing the issue in Thinking sphinx 1.4.11 gem also when I do ThinkingSphinx.search in my staging environment. But this does not happen in dev mode. Any idea why this might be happening?
This bug only happens in production, I was unable to reproduce it in development mode.
Using ThinkingSphinx 2.0.5 and Riddle 1.4.0.
The framework backtrace blame search.rb on line 913
My index (the relevant part...):
And my search call...
Switched back to 2.0.4 and everything is ok.