Separate results page’s settings

You can adjust Separate results page’s functionality with a global JavaScript variable called “addsearch_settings”. The variable must be defined above the script tag, that loads AddSearch with your SITEKEY.

General installation instructions can be found from this page.


Here’s an example of search results with the number of results, visible URLs, publishing dates and a possibility to sort by date or relevance.

The setup shown above can be defined with the following settings.

<!-- AddSearch settings -->
window.addsearch_settings = {
  display_url: true,
  display_resultscount: true,
  display_date: true,
  display_sortby: true


Currently addsearch_settings supports following settings:

false (default)
Display the target page’s URLs in search results
display_categorytrue (default)
Display the category texts in search results. Not shown if display_date is enabled
false (default)
Display the number of results found (result count)
false (default)
Display the publishing date of search results instead of category
date_format_functionJavaScript functionCustom JavaScript function to format publishing dates in search results. The function is called with Date object as a parameter
false (default)
Let the user sort search results by Date or by Relevance. See example
relevance (default)
Default order of results
(default: 10)
Number of results to show (1-30)
ga_tracking_idUA-xxxxxx-xGoogle Analytics tracking ID. Needed if Global site tag (gtag) in use
link_target_blank, _self, _top, _parentWindow or a frame where the clicked results link should open. E.g. _blank to open links in a new tab.
filtersSee Range filtersPre-defined search filters (beta)

Available JavaScript functions

Submit the search field

To submit the search field on search results page, call the following function.


Example of the implementation:

<input type="text" class="addsearch" placeholder="Search.." />
<button onclick="addsearch.submit()">Search</button>
<div id="addsearch-results"></div>

Dynamic category filters

With dynamic category filters, aka faceted search, you can let your users filter search results in real-time. In the example website you can filter our search to /blog or /support paths.

Category filters can be added and removed with a JavaScript function call:

addsearch.category(category, filterEnabled, [submitAutomatically]);
categoryCategory to apply. E.g. returns results from* and 1xnews returns results from /news/*
filterEnabledFilter enabled (true) or not (false)
submitAutomaticallyBy default, search results are refreshed automatically when the category function is called. If submitAutomatically is set to false, you need to call addsearch.submit(); function manually to refresh search results with new filters.

One way to use dynamic category filters is to add a checkbox to the Search results page:

<input type="checkbox" 
  onchange="addsearch.category('1xnews', this.checked)" />

When the checkbox above is checked, search results are limited to /news/* path. When the checkbox is unchecked, all results are returned.

See the full documentation of Category filters.

Range filters

With range filters you can let your users filter search results in real-time to meet a range criteria.

Range filters can be added and removed with a JavaScript function call:

addsearch.range(field, start, end);
fieldAccepted values: date
startStart value (inclusive). E.g. 2018-10-12
endEnd value (inclusive). E.g. 2018-12-24

For example, to let users filter search results to a specific date range, the function could be called with following parameters:

// Return docs published on January 1st, 2015 and later
addsearch.range('date', '2015-01-01', null); 

// Return docs published on May 30th, 2018 or before that
addsearch.range('date', null, '2018-05-30'); 

// Return docs published in 2018
addsearch.range('date', '2018-01-01', '2018-12-31'); 

// Return all docs
addsearch.range('date', null, null); 

Pre-defining range filter values

To pre-defined the selected range when search results are loaded, use the following setup:

window.addsearch_settings = {
  filters: {
    date: {
      start: '2018-01-01',
      end: '2018-12-31'