Skip to content

Search Term Prediction with our JS SDK

Looking for setup prerequisites, authentication details, and package references? Start with the TypeScript / JavaScript SDK landing page.

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, 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,
});

Open in StackBlitz

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