Outdated items

If you see search results that should not be displayed, or you think some results are missing from search, then your data feed may need to be updated more than once a day.

There are two methods to maintain your search results updated along the day:

  • Atomic Updates: This method requires development skills. You can use our management API to directly add, update or delete certain items from the search index. You will find more information about this technique in the Management API documentation.
  • Multiple Data Feed Processing Requests: This is the easiest method and the one we are going to use. It consists on performing a HTTP request against our Management API to indicate Doofinder that it must re-process the data feed.

Requirements

  • To make HTTP requests we are going to use a UNIX/Linux/Mac system and the cURL application.

To perform a request against the Doofinder Management API you need the id of the search engine that you want to update (we call it the hashid) and an API Token, a password-like string that will be sent with your request to authenticate it.

The hashid can be found in the list of search engines in your Doofinder control panel and is a 32-character string.

The API Token is part of the API Key. An API Key looks like this:

eu1-1234567890abcdef1234567890abcdef

and you can get it from your account in the Doofinder control panel.

The eu1 part of the API Token represents the zone where your search engine is stored. The API Token is what you get when you remove the zone from the API Key. In our example the API Token is:

1234567890abcdef1234567890abcdef

That's the value you will need to authenticate the request.

Learn more about the API Token and authentication in the Management API documentation.

The Request

Once you have your API Token we are going to perform an authenticated HTTP request against the API with the cURL tool:

$ curl -H 'Authorization: Token 1234567890abcdef1234567890abcdef' \
-XPOST https://eu1-api.doofinder.com/v1/abcdefabcdefabcdefabcdefabcdefab/tasks/process

In this case the API Token is 1234567890abcdef1234567890abcdef, the hashid is abcdefabcdefabcdefabcdefabcdefab and the zone is eu1.

If you are in a different zone replace eu1 ;in the URL by the proper zone.

A full example of the response of this command can be found in the Management API documentation.

Periodic Requests

To finish with the example, you will want to tell your server to perform the request at certain times.

For that, you can use the cron periodic task manager.

For example, this will ask our servers to process a feed each three hours:

0 */3 * * * /usr/bin/curl -s -H 'Authorization: Token 1234567890abcdef1234567890abcdef' -XPOST https://eu1-api.doofinder.com/v1/abcdefabcdefabcdefabcdefabcdefab/tasks/process > /dev/null

You may have to make slight modifications depending on your system or your requirements, like dumping the result into a log file.