In cases where the "Regenerate Data Feed" option is appropriate while connecting your product data to Searchspring, the following documentation explains how developers can write a custom regeneration script to take advantage of this Searchspring feature.
Simple Operation
When Searchspring calls your script via HTTP GET, execute the appropriate actions to regenerate the data feed at the location provided in the Data Feed Location URL. When finished, simply respond with the word "Complete" to indicate successful completion. Searchspring will then download the data feed and begin the indexing operation.
Iterative Operation
In cases where regeneration scripts may timeout before generating the entire feed, this method allows scripts to generate data feeds iteratively, in smaller chunks, through the use of multiple HTTP GET request and response cycles.
Use the @offset placeholder to designate a query parameter that Searchspring will pass with the current iteration's record offset for processing. Here's an example regeneration URL:
http://www.example.com/regenerate-datafeed.php?offset=@offset
Iterative Example
Here's a complete example for regenerating a data feed with 3000 total records over three iterations:
IterationSearchspring Requests (HTTP GET):Your Script's Response:Notes
Iteration 1: http://www.example.com/regenerate-datafeed.php?offset=0
- Continue|1000
- Searchspring replaced the @offset parameter with 0 for the very first iteration.
- Your regeneration script would process 1000 records safely within its timeout threshold. (Your script must determine an appropriate cutoff)
- Response Format: Continue|[Next Offset]
Iteration 2: http://www.example.com/regenerate-datafeed.php?offset=1000
- Continue|2000
- Searchspring now passes the offet received from the first response. This enables your script to know where to pick where it left off and process records 1000 - 2000.
Iteration 3: http://www.example.com/datafeed-update.php?offset=2000
- Complete
- The cycle repeats with your regeneration script finally responding with a Complete indicating that the data feed was successfully updated and is ready for re-indexing.
Comments
0 comments
Please sign in to leave a comment.