In rails, I am using searchkick
gem for search. When I am adding more fields for where clause then returning zero results.
Actually search is working for below method(User.rb),
searchkick word_start: [:name]
def initialize(name, limit = User::SUGGESTION_LIMIT, page = nil)
@name = name
@limit = limit
@page = page
@per_page = limit.to_i
end
query = {
match: :word_start,
fields: [{ emails: "exact" }, "name^5"],
misspellings: { prefix_length: 2 },
load: false
}
User.search(name, query).records
When I add condition like where: {active: false, inactive: true, deleted_at: nil}
it returns no data.
query = {
match: :word_start,
where: {active: false, inactive: true, deleted_at: nil},
fields: [{ emails: "exact"}, "name^5"],
misspellings: { prefix_length: 2 },
load: false
}
Is there any mistake in above where
condition? Please help me to solve this issue. I am using this gem for the first time.
Aucun commentaire:
Enregistrer un commentaire