Query usage in the 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
    • getCategory
      • Retrieves category idPath from the supplied path
      • Queries on the idPath.reverse term
      • Results are sorted by name field
    • getCategoryById
      • Queries on id.keyword term
      • Result is sorted 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
    • 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