pre-script hook

How to use search pre script hooks in expertrec control panel

Rate this article

Share this article

A pre-script hook is a piece of code that runs before the search is loaded.

Here are some applications of this pre-hook scripts feature-

  1. Increasing number of suggestions (or) drop down results in the search autocomplete UI
  2. Disable search listing pages.
  3. Increasing number of search results in a page.
  4. And more…pre-script hook

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

pre-script hook

  1. Go to https://cse.expertrec.com/?platform=cse and create your search engine.
  2. Go to script hooks-> prescript hooks and enter the following piece of code.pre script hook
  3. You can replace the number 10 to 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

 

Are you showing the right products, to the right shoppers, at the right time? Contact us to know more.
You may also like