Introduction
Incremental Updates (otherwise known as "partial updates" or "deltas") permit customers to update or add catalog data ´on the fly without the need to complete a full re-index. This method is applicable for a number of day to day use cases (see below) and aside from being much faster than the full update process (users need only present a sub-set of catalog data rather than the complete collection), users can also continue to access the Business Manager tool throughout their execution - so business productivity is unaffected.
Typical Use Cases
Experience has shown that many product attributes change in value throughout the course of trading. For example:
- an item's stock level may decrease
- an item's price value may increase
- a new variant has been added to the product catalog
In each case above incremental updates allow the customer to inform Fredhopper of these changes in a lightweight manner.
Standard Input Formats
| The section below assumes that you have opted to adopt the standard Fredhopper Data Input Format (more information). If this is not the case, then please contact your Fredhopper Consultant for advice on how to proceed. |
Overview
The table below lists all of the files that can be expected as part of the incremental update. Note that if your data model is such that there is no concept of variants then variants.csv and custom_variant_attributes.csv can always be omitted.
| File Name | Comments | Full Re-index Format Documentation |
|---|---|---|
| categories.csv (example file is attached at the bottom of the article) | This file should be the exact same format as that provided in the most recent full re-index data file upload: it should contain the complete category tree rather than just the categories which are related to the catalog items being updated as part of the incremental update. |
Input formats for products |
| products.csv (example file is attached at the bottom of the article) | This file should only contain references to the product ids which are to be updated as part of the incremental update. | Input formats for products |
| variants.csv (example file is attached at the bottom of the article) | Similar in logic to products.csv, this file should only contain references to any variants which are to be updated. | Input formats for variants |
| custom_attributes_meta.csv (example file is attached at the bottom of the article) | This file should contain attribute definitions for all of the attributes in the catalog, whether they feature within the incremental update or not. | Input formats for custom attributes |
| custom_attributes_values.csv (example file is attached at the bottom of the article) | This file should (ideally only) contain the product level attributes which are to be updated as part of the incremental update. | Input formats for custom attributes |
| custom_variant_attributes.csv (example file is attached at the bottom of the article) | This file should (ideally only) contain the variant level attributes which are to be updated as part of the incremental update. | Input formats for variants |
| The categories.csv and products.csv files are strictly required during an incremental update in the case of a multi-universe model. The category of the product is used to identify the universe to which the product belongs. The universe is used as a suffix of the primary_id attribute. |
Required Files
For most use cases, all the files listed above are required. There are a few exceptions for specific cases that allow you to send only the files that have the changed data. This can be helpful if changes are managed by a system that does not have an overview of the catalog and keeps the update small.
| Use Case | Files Required* | Other Requirements |
|---|---|---|
| Variant attribute update | variant_attributes, meta, categories | operation_type must be updated only, aggregation to product level is not supported, single universe setups only |
| Product attribute update | product_attributes, meta, categories | operation_type must be updated only, single universe setups only |
| Any other | all |
*Note that for standard transformations with a version before version 4, all files need to be present. However, the ones not specified can contain static dummy values, as in the attached example feed minimal-data-incremental.zip, which can be found at the bottom of the article.
Operation Type
The full re-index process always expects that the entire product catalog is provided within the data files provided; this differs in comparison to the incremental update process as here we may wish to update an attribute value, add a new product or even delete a variant from the catalog entirely. The means by which we inform Fredhopper which action to perform is defined by the "operation_type" special attribute. The locale for this attribute does not matter and if specified it will be disregarded. For example, if a variant with two locales has to be removed it is sufficient to include only one delete operation type in custom_variant_attributes.csv (see in the sample data below how this is done).
|
Do not specify IDs for operation types Please be aware that you must not specify an attribute_value_id for operation types. |
The "operation_type" attribute is defined within custom_attributes_values.csv and (if required) custom_variant_attributes.csv for each product/variant respectively and can be one of four values below. If no "operation_type" attribute is configured for an item then add is used as a default.
| Operation Type | Context | ||
|---|---|---|---|
| update | An existing item* needs to be modified. If the item does not exist no changes will be done. | ||
| replace | An existing item* (and all of its attributes) should be removed and replaced with new data. | ||
| add | A new item* has been defined in products.csv /variants.csv and attribute values need to be defined for the first time.
|
||
| delete | An existing item* needs to be removed. |
*An item can be either product or variant.
|
Updating Products and Variants FAS will execute all operations on exactly the specified item, so if both a product and its variants need updating those updates must be provided explicitly. The only exception to this rule is that delete-ing a product that has attached variants will remove both the product and all variants. |
Sample Files
The data model depicted below represents a single-universe, multi-locale deployment that has two categories (women & shoes) that contain two products and three variants in total.
The scenario below represents the following:
- p1 is updated with a new colour attribute value (blue).
- p2 is added to the product catalog.
- v2 is updated with a new price value (30.00).
- v1 is removed from the product catalog.
| The implemented csv files depicted below are attached at the bottom as data-incremental.zip. |
categories.csv
| category_id | parent_category_id | locale | name |
|---|---|---|---|
| catalog01 | catalog01 | en_US | Shop |
| catalog01 | catalog01 | de_DE | Geschaeft |
| women | catalog01 | en_US | Women |
| women | catalog01 | de_DE | Damen |
| shoes | catalog01 | en_US | Shoes |
| shoes | catalog01 | de_DE | Schuhe |
products.csv
| product_id | locale | category_ids |
|---|---|---|
| p1 | en_US | women shoes |
| p1 | de_DE | women shoes |
| p2 | en_US | women shoes |
| p2 | de_DE | women shoes |
custom_attributes_meta.csv
| attribute_id | type | locale | name |
|---|---|---|---|
| stock | float | Stock | |
| color | set | en_US | Colour |
| color | set | de_DE | Kleur |
| price | float | Price |
custom_attributes_values.csv
| product_id | locale | attribute_id | attribute_value_id | attribute_value |
|---|---|---|---|---|
| p1 | en_US | colour | blue | blue |
| p1 | de_DE | colour | blue | blauw |
| p1 | en_US | operation_type | update | |
| p2 | en_US | colour | red | red |
| p2 | de_DE | colour | red | rot |
| p2 | stock | 10 | ||
| p2 | en_US | operation_type | add |
variants.csv
| variant_id | product_id | locale |
|---|---|---|
| v1 | p1 | en_US |
| v1 | p1 | de_DE |
| v2 | p1 | en_US |
| v2 | p1 | de_DE |
| v3 | p2 | en_US |
| v3 | p2 | de_DE |
custom_variant_attributes.csv
| variant_id | locale | attribute_id | attribute_value_id | attribute_value |
|---|---|---|---|---|
| v2 | price | 30.00 | ||
| v2 | en_US | operation_type | update | |
| v1 | operation_type | delete |
Providing the Files to Fredhopper
Dependent on the deployment model of your choice, the incremental update csv files need be provided differently.
| Note that the steps below assume that the deployment already includes a set of data transformations to power the incremental update process. If in any doubt please contact your Fredhopper consultant to verify this. |
On-Premise
| Parameter | Comments |
|---|---|
| base_directory | This is the directory that contains the Fredhopper deployment (often c:\fredhopper). |
| indexer_name | This is the name of the indexer instance (defined within config/topology.txt). |
Step One
The incremental update csv files must be placed within:
<base_directory>/<indexer_name>/data/incremental
Step Two
Instruct Fredhopper to execute the incremental update data transformations by executing the following command from the <base_directory>:
bin\run-etl-job run-incremental.kjb "-DINSTANCE=<indexer_name>" "-DTRIGGER=load-data"
Step Three
Verify that the incremental update process completed without errors:
grep "ERROR" data/instances/etl/log/kitchen.log
Step Four
Please note that this step is necessary only on Fredhopper Platform versions starting from 8.1.
Send the generated files to the indexer instance:
bin/incremental-update <indexer_name>
Managed Services
| Parameter | Comments |
|---|---|
| username | Commonly the customer name (e.g. adidas). |
| password | The account password provided by your consultant. |
| region | The geographic region for the Managed Services environment (eu1 or us1). |
| environment | The Fredhopper environment which you wish to update (live1, test1 [...] test4). |
| checksum_value | The md5 hash value for data-incremental.zip (more below). |
Step One
Create a zip file named "data-incremental.zip" which contains all of the input files & calculate the checksum_value for this:
zip data-incremental.zip *.csv; md5sum data-incremental.zip > data-incremental.zip.md5
In this case the generated hash sum value = c4127cf7d913ecbe9fe4949706384f28.
Step Two
Upload the data-incremental.zip file to the Fredhopper Managed Services environment via the "fas" service interface; please note to include the checksum hash value in the request:
curl -D - -k -u <username>:<password> -X PUT -H "Content-Type: application/zip" --data-binary @data-incremental.zip https://my.<region>.fredhopperservices.com/fas:<environment>/data/input/data-incremental.zip?checksum=<checksum_value>
|
Data ID Please note the Data ID section of the server response, this shall be used in subsequent steps. The Data ID is unique to every request so one cannot copy the commands below in their entirety. |
HTTP/1.1 100 Continue
HTTP/1.1 100 Continue
Via: 1.1 my.fredhopperservices.com
HTTP/1.1 201 Created
Date: Thu, 03 May 2012 11:55:27 GMT
Server: Apache-Coyote/1.1
Location: https://my.<region>.fredhopperservices.com/fas:<environment>/data/input/2012-05-03_11-54-35/
Content-Type: text/plain
Via: 1.1 my.fredhopperservices.com
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
data-id=2012-05-03_11-54-35
Step Three
Thus far we have only uploaded data to the managed services environment; now, we shall initiate a Fredhopper reindex with this data.
curl -D - -k -u <username>:<password> -X PUT -H "Content-Type: text/plain" --data-binary "data-id=2012-05-03_11-54-35" https://my.<region>.fredhopperservices.com/fas:<environment>/trigger/load-data
The server response contains a Location value which we can use to monitor the status of the reindex:
HTTP/1.1 201 Created
Date: Thu, 03 May 2012 11:59:12 GMT
Server: Apache-Coyote/1.1
Location: https://my.<region>.fredhopperservices.com/fas:<environment>/trigger/load-data/2012-05-03_11-59-12
Content-Length: 0
Via: 1.1 my.fredhopperservices.com
Vary: Accept-Encoding
Connection: close
Content-Type: text/plain
The status value for the re-index may be found via:
https://my.<region>.fredhopperservices.com/fas:<environment>/trigger/load-data/2012-05-03_11-59-12/status
Possible values/reasons are detailed below:
| Status Code | Explanation |
|---|---|
| RUNNING | The data transformations are currently executing. |
| FAILURE | The data transformations encountered an error. Please study the kitchen log for error statements. |
| UNKNOWN | There was an issue with the trigger syntax, please verify that the curl request is valid. |
| SUCCESSFUL | The transformations completed without issue. |
In case of any error the kitchen-incremental.log file may be viewed via:
https://my.<region>.fredhopperservices.com/fas:<environment>/trigger/load-data/2012-05-03_11-59-12/logs/kitchen-incremental.log
FAQ (Frequently Asked Questions)
How long should it typically take before I see the incremental update changes reflected in the Fredhopper response?
This is dependent on both the amount of data provided within the input files as well as the complexity of the transformation logic, but generally, the changes should be reflected within five minutes or less.
Do incremental updates work if I don't use the standard CSV format?
Yes, however, you will need to work with your Fredhopper consultant to develop custom data transformations to support your file format.
Can I add other files (e.g. product rating information) in addition to the set of standard CSV files?
Yes, though you will need to work with your Fredhopper consultant to develop the data transformations to incorporate the new files.
If I delete a product id, do I also need to explicitly delete all its associated variants?
No. Fredhopper will automatically delete any child dependencies from the product id in question.
What happens if I try to add a product with an existing secondid value?
Fredhopper will reject the product id from being added to the catalog. An error statement reflecting this can be found in the xmlloader.log.
What happens if I try to replace a product with a non-existing secondid value?
Fredhopper will reject the product id from being added to the catalog. An error statement reflecting this can be found in the xmlloader.log.
Can I add a new category to the category tree as part of the incremental update?
Yes. Be sure to append this within categories.csv, detail the product to category relationship within products.csv, and then finally provide an update operation type statement for the secondid within custom_attributes_values.csv.
Can I remove a category from the category tree as part of the incremental update?
Yes though in this case it is best to persist the category id within categories.csv and replace the products which are assigned to it (stating the new product to category relationships) within products.csv and custom_attributes_values.csv.
Can I add new attributes as part of the incremental update?
Yes. In addition to providing these within custom_attributes_values.csv / custom_variant_attributes.csv please also remember to define the base type within custom_attributes_meta.csv.
Comments
0 comments
Article is closed for comments.