Searchspring Live Indexing and Pricing

Released In: 10.04.01


When using third-party tools to power search pages (and categories) it is critical that the product data they have in their system is as up to date as possible to prevent the display of stale data.

Searchspring provides a “Live Indexing API” which allows Miva to push up product changes in real time as they happen. That means Searchspring does not have to wait for the next interval of a bulk feed import to get the product changes. This is extremely helpful when new products are being added frequently, prices are being changed or inventory changes are causing products to go in stock or out of stock.


The Searchspring Live indexing API is intended to be used in conjunction with a nightly bulk product feed which can be done using Miva Product Data Fields & Feeds.

On this Page

Setup and Installation

To install the module, click the Settings header on the left side of the page, then click Modules and search for "Searchspring."

Alt text here

When installation is complete, click the User Interface header on the left side of the page, then click Global Settings. Next, click More and then click Searchspring Live Indexing and Pricing.

Searchspring Settings - Miva

Searchspring Queue

The module maintains its own queue of products that need to be updated in Searchspring. A product could need to be pushed back to Searchspring for any number of reasons including:

The only way to add/update/delete a product from the Searchspring Queue is via the template level functions defined below.

The main benefit of queueing products is it allows Miva to group the request together and have greater control over the 2.5Mb data limit or a Max of 500 records.

Force Delete Products From Queue

Under the module settings, there is a button to force clear any products from the Searchspring queue. Its located under the More menu in the modules admin configuration screen.

Searchspring - Delete Items from Queue

Template Functions

Upon installation of the module, a new item is automatically created named “searchspringlive.” This item needs to be assigned to any page template you wish to use the following functions:

Parameter Definitions

Flags: may be an empty string or "replace." If "replace" is specified, any existing entry with status "Q" for the product_id/feed_id combination of the same type is replaced by the new one. Otherwise, any existing entries are retained, and will be processed in the order in which they were queued.

For example, let’s say there were multiple updates to the same product with each update adding the product to the Searchspring queue. If you place a flag value of “replace,” only the latest record in the queue will be processed. If flag parameter is empty, each record will be sent to Searchspring processed in the order in which they were queued, creating duplicative data that Searchspring must consume.

product_id: the id of the product to add to the queue.

feed_id: The Searchspring feed_id. You must email to get this value for your account.

data: This is a JSON object of the full product record to be updated. You cannot update partial records, for example, just sending the price. It must be the full data set for the product you wish to send to Searchspring. These fields could be different on a per customer basis as custom fields you send to Searchspring are unique to you.

Delete Example

When using the delete function to add a product to be deleted to the queue, the data value needs to be a JSON encoded array of product ids to delete from Searchspring. When using this function its up to the caller to ensure the data is properly formatted. Whatever value you pass into for the data parameter will be wrapped in the records array:

A common place to utilize these template functions to add/update/delete products from Searchspring is in the Product Data Fields and Feeds module. It allows you to hook into the new Product Notification APIs and conditionally send the product to Searchspring if warranted.

Process Queue - Send Product Updates to Searchspring

The Searchspring queue is processed via a Scheduled Task. This scheduled task needs to be added after the module has been installed.

To set this up, click the Settings header on the left side of the page, then click Store Settings. Finally, click the Scheduled Tasks tab. Once there, click Create New Scheduled Task.

Alt text here

In the Operation dropdown, choose Process Searchspring Live Update Queue.

Scheduled Task Timing

The timing of how often this scheduled task runs can be configured from this screen. However, in most cases, since you want the data updated in Searchspring as soon as possible after the update occurs, it will be better to leverage triggers to tell Miva to processes the queue.

See an example of how to leverage triggers with the Product Data Field & Feeds module here.

Bulk Indexing Status Check

Just before the Scheduled Task is set to run, Miva will make a call to Searchspring to see if there is currently a Bulk Index in process. If yes, this means that Searchspring is currently processing a bulk data feed and the live indexing updates will wait until this process is complete. An informational message will be logged in Miva if the task is prevented from running.

JSON Functions

The module provides a runtime JSON API function that is used on the website to get real-time, customer-level pricing and inventory levels for an array of products. This is useful when needing to update the pricing returned from the Searchspring API for specific customers.

This function will allow you to pass on an array of product codes or Ids and get back the current price (including any discounts) and inventory counts. This function is intended to be called in front end JavaScript for when a third-party search provider may not have the most up to date pricing or discount data for products

XML Provisioning

Below are the XML provisioning tags available:

Using Product Data Fields and Feeds with Searchspring

Looking for Developer Docs?

We have a whole section for that, including: Developer Training Series, Template Language docs, Module Development tutorials and much, much more.

Head to the Developer Section

This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.


Copyright © 1997 – 2021 Miva©, Miva Merchant©, MivaPay©, MivaCon© Miva, Inc. All Rights Reserved.