Help Center

< Back


There are four different instances where a Javascript can be run before or after the Search results are rendered and the page is loaded.

Run custom Javascript before the page loads.

Run custom Javascript before the Search query is sent to the server.

Run custom Javascript before the Search results load.

Run custom Javascript after the Search results load.

Script-Hooks can be used to run Javascript code at various instances before or after the search is loaded.

Here are some applications of this Script-Hooks scripts feature-

  1. Increase the number of suggestions (or) drop-down results in the search autocomplete UI
  2. Disable search listing pages.
  3. Increase the number of search results on a page.
  4. Disabling the search results page and more.

Here is an application – Increase the number of search results in search autocomplete.

Here we will take an example of how to increase the number of suggestions in the search drop-down using the PRE-INIT script. By default, there are 5 results in the autocomplete.

pre-script hook

  1. Go to and create your search engine.
  2. Go to Script-Hooks > PRE-INIT and enter the following piece of code.
  3. You can replace the number 10 with the number of results you want in the suggestions.
    _er_config.append_to_response.suggestion_size = 10;
  4. Now reload your search page and you will be able to see 10 results in the autocomplete.pre-script hook

For more information about running custom scripts along with Expertrec Search, please contact the technical support team here.

Take me to the page

Table of Contents