Skip to content

Search Term Prediction with our JS SDK

Our SDK helps making requests against our API eaiser for you. It works both with strongly-typed TypeScript and with JavaScript. You can also use it direcly via a CDN provider. Read more about that here. If you do use it directly from a CDN, then all of our types are namespaced with a Relewise.-prefix. So to get the searcher you need to write new Relewise.Searcher() instead of new Searcher().

Before going any further, make sure you have read the following:

  • Read about how to authenticate against our API here.
  • Read about handling different types of users here.

The following shows an example on how to perform search term prediction with Relewise:

If you wish to perform search term prediction alongside regular search requests, you can do so using search request batching.

ts
const settings = {
    language: 'da-DK',
    currency: 'DKK',
    displayedAtLocation: 'Search Page',
    user: UserFactory.anonymous(),
};

const builder = new SearchTermPredictionBuilder(settings)
    .setTerm('shoe')
    .take(10);

const searcher = new Searcher(RELEWISE_DATASET_ID, RELEWISE_API_KEY, {
    serverUrl: RELEWISE_SERVER_URL,
});

Don't know us? Don't worry - you can find more information about us, by visiting our main page www.relewise.com