Basic Search and Result Client Example

This article provides an interactive example of a basic search interface implementation, i.e., it provides a simple search and result loop with accompanying usage analytics events. You may find this example useful as a starting point for your own search interface, or simply to familiarize yourself with the concepts involved. You can download the two working example files below:

Once downloaded, ensure both files (.js and .html) file are located in the same directory. To run the script, you can:

  • Double-click the .html file.
  • Right-click/secondary click the .html file and choose to Open with... the browser application of your choice.
  • Drag and drop the .html file in the tab section of an open browser application that supports this feature (e.g.: Google Chrome).

If you have a programming background, you can edit the script by replacing the provided sample access token and organizationId to conduct search using your own indexed sources, for example. Make sure to read the comments in the .js file for guidance.

You can also directly interact with the client using the example section below:

Enter a keyword in the search box below (e.g., "test"), then click the 'Search' button. The search API request and corresponding usage analytics event will be displayed along with an example result list. Click one of the results to view the corresponding usage analytics click event.

Recommended Articles