ShopifyIndexer
ShopifyIndexer
indexes Shopify products into a catalog, including automatically resolving the url
and imageUrl
document fields. It also handles deletion of unavailable products that were previously indexed.
Example
ShopifyIndexerOpts
shopifyBaseUrl
: The base URL of the Shopify store.maxItems
(optional): The maximum number of items to index.batchSize
(optional): The number of items to process in each batch (default: 25).
Methods
index()
Indexes the Shopify products into the catalog. This method fetches products from the Shopify API, processes them, and adds them to the catalog. It also handles the deletion of unavailable products.
Usage
This method performs the following tasks:
- Fetches products from the Shopify API.
- Processes each product, extracting relevant information.
- Adds available products to the catalog.
- Marks unavailable products for deletion.
- Respects the
maxItems
limit if specified. - Indexes the processed products in batches.
- Deletes the marked products from the catalog.