Query usage in EDP

  Written by The Jahia Team
 
Developers
   Estimated reading time:

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

getCategory

  • Retrieves category idPath from the supplied path
  • Queries on the idPath.reverse term
  • Sorts results by name field

getCategoryById

  • Queries on id.keyword term
  • Sorts results on name.raw field

getCategoryByRegularPath

  • For example, /brands/667

getCategoryIdPath

  • 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

getProductsPaths

  • Uses either getProductByName or getProductBySku to retrieve the paths of the queried products

getProductByname

  • Boolean query with 2 sub queries
    • Exists:
      • variants && baseProduct
    • Should:
      • name(field) && >=75% match
      • name(field, deletes all whitespace) && >=75% match
  • Must match at least 1 item

getProductBySku

  • Queries ElasticSearch product index using the query term SKU to retrieve any products that match