-
Notifications
You must be signed in to change notification settings - Fork 369
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
How to combine Weighted Search & Association Search #40
Comments
Interesting, we definitely overlooked that when we came up with the syntax for What do you think is a natural way to specify weighting for associated parameters? I can't think of a good syntax offhand, so I'd like to do some thought experiments first to figure out what the best approach would be. |
Hmm, well my first thought was to put the :associated_against inside the :against. so like
even, though it looks confusing, that was the first thing I attempted to do (it made sense to just put the entire snippet to see if it worked. Obviously the repetitive => may be a problem. |
Any updates on this issue? |
None yet. I haven't had the time to dig into this too deeply. I like the idea of using hashes as keys of hashes. In fact, it even helps with the coincidence that because of the way we read associated attributes, if you have multiple attributes on the foreign object, they all get grouped together into one string and thus we can only give one weight to the entire thing. |
Thanks for the quick reply. I'll be on the lookout for an update :) |
Upvote :) |
A helpful StackOverflow discussion of this issue, also by kibaekr: http://stackoverflow.com/questions/10667242/rails-how-do-i-search-tags-generated-by-act-as-taggable-on-with-pg-search-pos I'd love to get the new syntax proposed. |
+1 |
3 similar comments
+1 |
+1 |
+1 |
Apologies if I'm misunderstanding, but shouldn't this issue be closed considering #132 has been answered? |
@jaypinho thanks for the helpful note. Yes, it does look like the answer to #132 applies here as well. So, we would expect this to work: pg_search_scope :search_by_tag, :associated_against => {
:tags => [{:name => 'A'}]
} If this doesn't work for your use case, feel free to reopen with more information on how to reproduce the problem. Thanks! |
It looks like in both this issue and #132 , the conversation dropped off without anyone testing out the syntax above. When I tried syntax like that, I get this error:
|
Hmm, I wouldn’t be surprised if something changed in the last several years that introduced the error you’re seeing. We should get test coverage around the problem you’re seeing. |
(in a new issue) |
I should have checked, but I'm using version 2.0.1. That's newer than the discussion above, but far from up-to-date. |
Weghted Search and Search through Associations works separately, but I was wondering how I could combine them. So I want to add the associative search as one of the weighted params.
Currently, I have
How would I incorporate the search_by_tag as one of the weights 'A'?
The text was updated successfully, but these errors were encountered: