Reputation: 3029
Is it possible to use multiple fields for searchkick's autocomplete feature? It seems to be searching only the first field specified.
For example, for a person with the first_name
"Foo" and last_name
"Bar"
Person.search("Fo", fields: [first_name: :text_start, last_name: :text_start])
- returns result
Person.search("Ba", fields: [first_name: :text_start, last_name: :text_start])
- no results found
Upvotes: 1
Views: 530
Reputation: 10856
I'm not too familiar with it, but I think so. From the docs:
https://github.com/ankane/searchkick#autocomplete
City.search "san fr", fields: [{name: :text_start}]
That seems to imply that you can give an Array of Hashes. When you don't specify the squiggly brackets like you do that will make one Array with one Hash.
Upvotes: 2