Skip to content
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

Zero results when search by association id #104

Closed
ivane-gkomarteli opened this issue Jul 12, 2019 · 4 comments
Closed

Zero results when search by association id #104

ivane-gkomarteli opened this issue Jul 12, 2019 · 4 comments

Comments

@ivane-gkomarteli
Copy link

ivane-gkomarteli commented Jul 12, 2019

After updating riddle from 1.5.12 to 2.3.2 the following query returns 0 results.

User.search("", { with: { post_id: ["24"] }, sql: { include: [:post] } } )

Sphinx Query (1.6ms) SELECT * FROM user_core, user_delta WHERE post_id IN ('24') AND sphinx_deleted = 0 LIMIT 0, 20
Sphinx Found 0 results

Reverting the version back the query works correctly.

@pat
Copy link
Owner

pat commented Jul 12, 2019

Which version of Thinking Sphinx are you using? I think you'll need to update that at the same time as updating Riddle.

@pat
Copy link
Owner

pat commented Jul 12, 2019

In particular, you'll want to either upgrade to TS v3.4.0, or cast any filter values to their appropriate types - so, in this case, the post_id filter should be an array of integers.
https://github.com/pat/thinking-sphinx/releases/tag/v3.4.0

If you upgrade to TS v4, you'll also want to do this casting - TS v3.4 just puts in some extra work to do the casting for you (but it means running a search requires a lot more computation). The reason for this change is that Riddle (and TS) presumed that string values couldn't be filterable, so it would not surround them in quotes. However, Sphinx has supported string filters for a while now, hence sometimes quotes are needed, and that's now figured out based on the types of the arguments.

@ivane-gkomarteli
Copy link
Author

I was using TS v3.2.

Updating to 3.4.0 seems to fix the problem.

Thanks for the explanation.

@pat pat closed this as completed Jul 12, 2019
@pat
Copy link
Owner

pat commented Jul 12, 2019

Great to know it's working properly again :) I do recommend upgrading to v4 if possible - which will mean casting values appropriately - but I understand that might take a bit more time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants