I'm using Tire on my Rails application, but the lack of documentation really frustrated me. I know the gem is "ReTire" but I need use him until I change to other gem.
I have a problem on filter like this simple query
SELECT product FROM products WHERE (price = 20 OR productID = "XHDK-A-1293-#fJ3") AND (price = 30)
I already did it on Elastic Search string query:
GET /my_store/products/_search
{
"query" : {
"filtered" : {
"filter" : {
"bool" : {
"should" : [
{ "term" : {"price" : 20}},
{ "term" : {"productID" : "XHDK-A-1293-#fJ3"}}
],
"must" : {
"term" : {"price" : 30}
}
}
}
}
}
}
It's simple and worked! But I don't know how to make this on Tire structure. I already tried a lot of solutions, none worked.
I need a path to the solution.
Have you tried the following by any chance?
Tire.search 'products' do
query do
boolean do
should { string 'price:20' }
should { string 'productID:XHDK-A-1293-#fJ3' }
must { string 'price:30' }
end
end
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.