Query usage in EDP
October 8, 2024
The StoreDataSource class contains several methods that enable you to query the Elasticsearch index for both categories and products. Commerce IO uses this information to create and get external nodes in the External Data Provider (EDP).
This section describes and provides a brief overview of methods used by Commerce IO.
Category methods
- Retrieves category idPath from the supplied path
- Queries on the idPath.reverse term
- Sorts results by name field
- Queries on id.keyword term
- Sorts results on name.raw field
- For example, /brands/667
- Uses getCategoryByRegularPath to retrieve categories from the index based on the specified path, this is the node path that is used (for example, /brands/667/landing)
Product methods
- Uses either getProductByName or getProductBySku to retrieve the paths of the queried products
- Boolean query with 2 sub queries
- Exists:
- variants && baseProduct
- Should:
- name(field) && >=75% match
- name(field, deletes all whitespace) && >=75% match
- Exists:
- Must match at least 1 item
- Queries ElasticSearch product index using the query term SKU to retrieve any products that match