-
Notifications
You must be signed in to change notification settings - Fork 469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom primary key lost on reload #1125
Comments
pat
added a commit
that referenced
this issue
Mar 2, 2019
I feel like I've hit this problem before, and I thought I'd restructured things in v3 onwards to avoid it, but I guess not. It's reared its head again in #1125 - the cached configuration's indices kept onto their old references to models, whereas models returned from ActiveRecord search calls were using the new references, and thus not quite matching. It wasn't a problem if all models were using the default primary key of 'id', but otherwise with alternative primary keys things would break.
I'm surprised this issue hasn't cropped up before, but thanks for logging it! I've pushed a fix to the develop branch, and will be a part of the next release (hopefully within the coming week). If you want something in your app now, you can put the following in your config.to_prepare do
ThinkingSphinx::Configuration.reset
end |
Thanks, we appreciate it! |
Just published v4.2.0 which includes this fix :) |
h3nnn4n
pushed a commit
to jobscore/thinking-sphinx
that referenced
this issue
May 14, 2019
I feel like I've hit this problem before, and I thought I'd restructured things in v3 onwards to avoid it, but I guess not. It's reared its head again in pat#1125 - the cached configuration's indices kept onto their old references to models, whereas models returned from ActiveRecord search calls were using the new references, and thus not quite matching. It wasn't a problem if all models were using the default primary key of 'id', but otherwise with alternative primary keys things would break.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure if this is a Rails (4.2.8) issue or a Thinking Sphinx (4.0.0) issue. In the development environment after a reload the the primary_key on the model doesn't appear to be set and calling count on an instance of ThinkingSphinx::Search tries to do the query with id instead of the primary key.
Edit: After doing some digging this appears to be happening with all models, but the default is :id so it doesn't error out for those models.
The text was updated successfully, but these errors were encountered: