Use custom query to select specific products or variants

Before deep diving into the example use case, we will give general knowledge about the parameters that can be used to query at the search bar in the Specific Products and Specific Variants option.

 

There are 16 types of parameters that you can use for "Specific Products" query.

  • id
  • vendor
  • title
  • price
  • sku
  • gift_card
  • has_only_default_variant
  • barcode
  • inventory_total
  • is_price_reduced
  • out_of_stock_somewhere
  • product_type
  • status
  • tag
  • created_at
  • updated_at
and there are 16 types of parameters that you can use for "Specific Variants" query.
  • vendor
  • tag
  • title
  • collection
  • barcode
  • product_id
  • gift_card
  • inventory_quantity
  • location_id
  • managed
  • managed_by
  • product_status
  • product_type
  • sku
  • taxable
  • updated_at
There are also 5 comparators that  are often used for search queries:
  • : (equality)
  • :< (less-than)
  • :>  (greater-than)
  • :<= (less-than-or-equal-to)
  • :>=  (greater-than-or-equal-to)
  

Now, let's dive into the example use case:


1. Search Products or Variants by a specific vendor
so let's say we want to search products by vendor, we can use a query like this "vendor:your_vendor_name", see the example below
query= vendor:Boeing
specific vendor


2. Search Products or Variants by a specific pattern
in this use case, let's say we want to search title that has a prefix "Airbus-1", we can use asterisk(*) for this case. Please see the example below


query= title:Airbus-1*


title that contains
So, as you can see all the title that contains "Airbus-1xxx" will be listed. You can also implement this if you want to search by the suffix of the title.


3. Range Search
A range search specifies a range of values to search against. Supported operators are >, >=, < and <=.
The following query matches documents where the inventory_quantity field is greater than 100 and less than or equal to 160:


query= inventory_quantity:>100 AND inventory_quantity:<=160



4. Field Search
Field searches apply to terms in specific fields.
The following query searches for "shirt" in the tag field AND "adidas" in the vendor field:


query= tag:shirt AND vendor:adidas
The value must immediately follow the field with no whitespace.



 
There are some of the use cases that you can use to search for the products or variants. You can use it based on your needs.


If you have any questions, please kindly write us an email to our support at support@rubixhouse.com