-
Notifications
You must be signed in to change notification settings - Fork 63
Apply find_by_fuzzy on an ActiveRecord::Relation #37
Comments
Hi @chrilleferna, noted. This is probably related to #18. The problem is that the current (efficient) implementation aggregates the Could you provide more details about what you obtain & what you expect? Ideally in the form of a (failing) test case? |
It is somewhat related but not entirely. It does indeed break: the example I gave above will generate an exception if not all the fuzzily found persons are in the country. The exception occurs in searchable.rb/_load_for_ids when you do find(ids). This is due to the fact that not all the ids found in the trigrams are in the scope.
I'll send a pull request so you can take a look -- christer |
I've ran into exactly the same issue. Code breaks when using where(..).find_by_fuzzy.. |
I have a similar problem. I'm searching a db of books for a match on title & author. I would like to chain the fuzzy find: Book.find_by_fuzzy_title('Title', :limit => 10).find_by_fuzzy_author('Author', :limit => 1) The second fuzzy find fails. Is there a better way to go about this? |
I would like to see the same thing, +1 for being able to chain scopes and feed them into find_by_fuzzy_ |
find_by_fuzzy can be applied to a class but not to an ActiveRecord::Relation (or a scope). A typical case when this would be very useful is when you want to make an exact match on one attribute followed by a fuzzy match on another attribute, like:
The text was updated successfully, but these errors were encountered: