问题
Hey guys I try to do some searching functions but it is not possible with shopifyAPI gem
ShopifyAPI::Product.find(:all, conditions: ["title LIKE ?", "%#search%"], params: {limit: 20, page: 1})
With this function I got all products.
ShopifyAPI::Product.find(:all, conditions: ["title LIKE ?", "%#search%"])
The same I got all products
ShopifyAPI::Product.search(parameters)
I found this function in this example but it is not a function anymore => ecommerce.shopify.com/c/shopify-apis-and-technology/t/ruby-shopifyapi-find-customer-by-email-215330
ShopifyAPI::Product.where({ "title LIKE ?" =>"%#{search}%" })
With this one I got all products, again
This is the shopify_api gem => help.shopify.com/api/reference/product.
This is the shopify_api => help.shopify.com/api/reference/product
回答1:
It doesn't look to me like the Shopify API supports this. What you're trying to do looks like ActiveRecord querying, but this gem only provides an Active Record-like syntax.
The API does support searching based on product title, so perhaps you may be able to specify a single word or two from the product name it and it will match those?
回答2:
You can use direct fields to search like:
ShopifyAPI::Product.find(:all, params: { limit: 10,
title: params[:title],
page: params[:page] })
来源:https://stackoverflow.com/questions/41539936/shopify-api-how-to-do-a-search-query-with-like