Overview of the v2 jobs
For an overview of the v2 job system, see Indexing overview.Before you begin
Delta exports
To take advantage of this new, more efficient job type for incremental product updates, raise a Salesforce support ticket to activate the feature. For more information, see Ongoing indexing.Estimated upgrade duration
The duration of the upgrade depends on the extent of customization you have applied to the jobs. If you plan to fully transition to the v2 jobs without any extra customizations, the upgrade should take about 30 minutes to two hours to complete (excluding testing). If you have made customizations or extensions to the v1 jobs and want to apply them to the v2 jobs as well, the upgrade duration depends on the extent of these.Before attempting any such customizations,
consult your Solutions Engineer,
Customer Success Manager/Engineer,
or submit a Support ticket
to discuss recommended integration approaches.
Comparison of the jobs
The old jobs (v1)
- Relied on the old B2C job framework (no
steptypes.json) - Were sequential (no parallelization)
- Relied on intermediary XML files to store data temporarily
- Relied on a middleware to split the data into multiple indices by locale
- Delta calculation was slow with large datasets due to calculating the delta by comparing the current full catalog export to a previous one (snapshot) and writing the diff into a file
- Couldn’t be used for multi-instance indexing (where part of the product data is sent from Staging, while another part from Production)
- Use a less error-resilient and scalable end-to-end indexing approach and have limited monitoring and logging capabilities
List of v1 jobs
AlgoliaCategoriesIndex- for indexing the category treeAlgoliaProductsIndex- for indexing product data - both full catalog indexing and product delta updatesAlgoliaProductsDeltaExport(v23.4.x only) - an earlier, sequential version of the v2 delta jobAlgoliaProductPricesExport(v23.4.x only) - an earlier, sequential version of the v2 price jobAlgoliaProductInventoryExport(v23.4.x only) - an earlier, sequential version of the v2 inventory job
The new jobs (v2)
- Rely on the newer B2C job framework (
steptypes.json) - Are chunk-based and parallelized (chunks are executed in parallel). Full (atomic) reindexing provides a zero-downtime full catalog reindexing option, useful for removing stale .
- Don’t use intermediary XML files. Data is processed in chunks and sent immediately at the end of each chunk
- Send data directly to Algolia
- Data is split into multiple indices by the B2C job internally
- There’s less possibility for error due to the end-to-end chain being shorter
- Delta calculation is fast since it uses the platform’s built-in delta export mechanism
- Temporary data isn’t written to a file before sending
- B2C delta exports provide a fast and efficient way to determine which products have changed since the last export
- Can be used for multi-instance indexing (part of the product data can be sent from staging, while another part, such as inventory or price data, from production)
- Partial updates allow for more frequent, lightweight updating of specific attributes rather than the entire record (for example price or inventory data only)
- Text-based logs are more verbose, they cover more edge cases and error messages contain more information
- Have a more extensive job reporting and monitoring system where reports are stored as custom objects instead of an XML file and are cleaned up automatically after a predetermined amount of time
List of v2 jobs
AlgoliaCategoryIndex_v2- for indexing the category treeAlgoliaProductIndex_v2- for full catalog indexing (incl. full reindexing)AlgoliaProductDeltaIndex_v2- for product delta updatesAlgoliaProductInventoryIndex_v2- for indexing inventory data onlyAlgoliaProductPriceIndex_v2- for indexing price data only
Changes from previous versions
The list of base (non-configurable) attributes has changed, as well as the recommended starting list of Additional Product Attributes (configurable), which was previously called “Custom Fields”.Base attributes
- Changed from:
id, primary_category_id, in_stock, price, categories - To:
name, primary_category_id, in_stock, price, categories, image_groups, url
id is always sent (as the objectID field).Additional product attributes recommended starting list
- Changed from:
name, short_description, long_description, price, brand, color, size, image_groups - To:
short_description, long_description
You can extend this list with any other attributes you like to index, see Indexing attributes.
Items added or updated in the latest version
Jobs
AlgoliaCategoryIndex_v2AlgoliaProductIndex_v2AlgoliaProductDeltaIndex_v2AlgoliaProductInventoryIndex_v2AlgoliaProductPriceIndex_v2
Services
algolia.http.search.write- used by the v2 jobs
Site preferences
Algolia_AdditionalAttributes(fromAlgolia_CustomFields)
Items to remove after the upgrade
You can remove these items after you move to the v2 jobs. Importingservices.xml from version 26.7.0 or later deletes the algolia.http.export service.
Remove the other items by hand.
For more information, see Remove the v1 jobs and their configuration.
Jobs
AlgoliaCategoriesIndexAlgoliaProductsIndexAlgoliaProductsDeltaExportAlgoliaProductPricesExportAlgoliaProductInventoryExport
Services
algolia.http.api(versions before 23.3.0) and related credentials and profilealgolia.http.export(versions 23.3.0 and later) and related credentials and profilealgolia.http.ingestion(versions 23.3.0 to 23.4.1) and related credentials and profile. Indexing with the Ingestion API doesn’t use this service.
Site preferences
Algolia_HostBaseAlgolia_OCAPIClientIDAlgolia_OCAPIClientPasswordAlgolia_CustomFields(renamed toAlgolia_AdditionalAttributes). You can removeAlgolia_CustomFieldsif you’re not planning on using the v1 jobs in the future
Migration steps
Take care when upgrading customized files so that you don’t overwrite any customizations. For any customizations and extensions you’ve made to the cartridge, consider whether they’re still applicable as they may now be supported by the cartridge natively:- Partial updates (including for price and inventory data updates)
- Multi-instance indexing
- Facet bucketing
- Server-side rendering of category landing page and search results (first page only, can be extended) for improved SEO
- Starting with v24.3.0, the cartridge lets you customize advanced product attributes without having to modify the jobs’ code. Use it for all customizations.
- Configurable record structure (starting with v.24.2.0)
Upgrading the cartridge doesn’t remove the v1 job definitions from your instance, and new installations don’t create them.
From version 26.7.0, the cartridge doesn’t include the v1 job code, so v1 jobs left on an instance end in error.
To remove them, see Remove the v1 jobs and their configuration.
Update the code
- Download the latest cartridge version from Algolia B2C Cartridge GitHub repository.
- Remove the previous cartridge version from your repository and add the new version, so that no outdated files remain. If you customized the v1 jobs, move your customizations to the v2 jobs. For the main logic changes, see Code changes highlights.
Code changes highlights
To help you migrate your customizations, this section highlights the main logic changes between the two cartridges.The v2 jobs use different files from the v1 jobs:
algoliaLocalizedProduct.jsreplacesalgoliaProduct.js(the data model)algoliaProductIndex.jsreplacesproductsIndexJob.js(the main job logic)
Generated data
Before version 23.5.x (v1), jobs built the records data with theAlgoliaProduct model (algoliaProduct.js).
For each product, this model generates a JSON object, where each attribute is an object containing values for each enabled site locale.
The final object looks like this:
JSON
AlgoliaLocalizedProduct object (algoliaLocalizedProduct.js) for each desired locale.
A typical record from this model looks like this:
JSON
Jobs logic
The v1 job code:- Generates models with the
getNextProductModel()helper - Wraps the models into an
UpdateProductModelobject. This object is sent to the indexing middleware. - The middleware splits the provided object to create one final record per locale. This is then sent to the corresponding Algolia index.
algoliaProductIndex.js file.
Thus, one of the main differences between v1 and v2 is the location of the loop handling the locales:
For v1 jobs, the loop is inside the AlgoliaProduct model, when fetching a product attribute value:
JavaScript
JavaScript
Update metadata, jobs, and services
- Import metadata files from the
metadata/algolia/metafolder in the repository:system-objecttype-extensions.xmlandcustom-objecttype-definitions.xml - Import job definitions:
metadata/algolia/jobs.xml - Import services:
metadata/algolia/services.xml
For detailed instructions on importing files in Business Manager, see the Set up the Algolia cartridge page.
Business Manager configuration updates
- Go to the Merchant Tools > Algolia > Algolia in Business Manager
- Fill in your Additional Product Attributes according to your use case.
You can start withshort_description, long_description.
Job configuration
- Go to Administration > Operations > Jobs in Business Manager
- For each of the v2 jobs, set the execution site by clicking on the job, then go to Job Steps. Click Scope and then select the sites you want to run the jobs for.
- Click AlgoliaProductDeltaIndex_v2, click Job Steps, then *Job Parameters
- Click the catalogIDs parameter and add the catalog IDs assigned to your sites.
Remove the v1 jobs and their configuration
The v1 jobs stopped working on October 31, 2024, when the Stream middleware athttps://sfcc-stream.algolia.com was sunset.
From version 26.7.0, the cartridge doesn’t include them.
After you move to the v2 jobs, remove the v1 jobs and their configuration from your instance.
Jobs
Go to Administration > Operations > Jobs and remove the v1 jobs:AlgoliaCategoriesIndexAlgoliaProductsIndexAlgoliaProductsDeltaExportAlgoliaProductPricesExportAlgoliaProductInventoryExport
Services
Go to Administration > Operations > Services and remove these services with their credentials and profiles:algolia.http.apialgolia.http.export. Importingservices.xmlfrom version 26.7.0 or later deletes it.algolia.http.ingestion
Site preferences
Go to Administration > Site Development > System Object Types > SitePreferences > Attribute Definitions and filter for preferences starting with “Algolia_” by searching for “Algolia_*”.
Remove the following site preferences:
Algolia_HostBaseAlgolia_OCAPIClientIDAlgolia_OCAPIClientPasswordAlgolia_CustomFields(renamed toAlgolia_AdditionalAttributes)
Algolia_OCAPIClientID and Algolia_OCAPIClientPassword, encrypted, to the Stream middleware.
If that API client isn’t used for anything else, deactivate it in Account Manager.
Job files
The v1 jobs stored their reports and intermediate XML files in the Impex > src > Algolia folder. The v2 jobs don’t use this folder. To delete the files, go to Administration > Site Development > Development Setup > Folder Browser > Impex > src > Algolia. Version 26.7.0 removes the v1 Job Reports (Deprecated) section from the Algolia Business Manager module.Confirm the success of the upgrade
Your , Search , and Admin API key should be configured already from your previous installation (go to the Algolia Business Manager module and set them up if not). After performing the preceding steps to upgrade to the v2 jobs, the Algolia v2 jobs appear in Business Manager under Administration > Operations > Jobs. Run all the jobs, one after the other, and verify whether they finish with anOK status.
Go to your Algolia dashboard and confirm that your indices were updated.