Love Tire and elasticsearch so far but can't figure out how to search values between ranges like:
And return all Profile's where the age is between these 2 ranges? I have a integer column Profile.age
So far incomplete function
def self.search(params)
#, default_operator: "AND
tire.search(load: true, page: params[:page], per_page: 20) do
query do
should { string params[:query] } if params[:query].present?
should { integer age_to[:age_to] } if params[:age_to].present?
end
to_curl
end
end
query do
should { string params[:query] } if params[:query].present?
should { range :age, { gte: params[:age_from], lte: params[:age_to] } } if params[:age_to].present? && params[:age_from].present?
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.