ruby on rails - Searchkick Elastic Search where condition like behavior -
using rails 4.2 searchkick , elasticsearch, have conditions set find users:
where_data = { region: "north america" } results = person.search( query, where: where_data )
this works expected , finds person when person.region
"north america".
but there other situations person has multiple regions, including north america: "africa; north america". in these cases person not found.
how can customize data or calls operate more like
in sql, , find matching instances of full string?
to search person region contains "north america", first try:
person.search "north america", fields: [:region]
if doesn't work, try adding person model:
class person < activerecord::base searchkick word_middle: [:region]
and (after reindex)
person.search "north america", fields: [:region], match: :word_middle
if still doesn't work, suggest making :region
collection in es (please let me know if interested, have done before using searchkick don't recall exact code. can pull , post later)
Comments
Post a Comment