AddSearch is an instant search for websites that gives results immediately, from the first keystroke. Implementing the AddSearch instant search onto your Drupal site is very easy, and takes only minutes.

How to Install AddSearch onto a Drupal Site

First, find your Site key by following these instructions:

  1. Login to your AddSearch Account
  2. Go to Keys and installation under Setup
  3. Copy your site key under Your Site Key

Use our Search Designer tool to configure the widget according to your needs and copy the installation script. Then paste the script into your website template to the place where you want the AddSearch field to appear. Here is an example of what the script snippet might look like:

The code you need to copy looks like the script below, where key is a numerical identifier field for your site:

<script>
 window.addsearch_settings = {
  "asw_01": {
    "placeholder": "search",
    "results_box_opening_direction_v2": "right",
    "show_search_suggestions": true,
    "search_suggestion_position": "right",
    "default_sortby": "date",
    "display_date": true,
    "display_meta_description": false,
    "display_result_image": true,
    "link_target": "_top",
    "hide_logo": true,
    "direction": "ltr",
    "analytics_enabled": false,
    "automatic_filter_results_by_site_language": true
  }
} 
</script>
<script src="https://cdn.addsearch.com/v4/addsearch-ui.min.js?key=xxxxxx&id=asw_01"></script>

Apply the Script to any Page on Drupal Admin

  1. Login to your Drupal Admin
  2. Go to content from admin menu on top. Then click on “Add Content” or edit any existing pagedrupal content
  3. Click on source and add the paste the AddSearch script where you want the search bar to appear, then click “Save”Installing AddSearch on Drupal Website
  4. Congrats, you’re done! Try out your search by typing a letter into the search box; you’ll notice the difference immediately

Apply the Script as a New Block Drupal Admin

  1. Login to your Drupal Admin
  2. Go to “Structure” from the admin menu and click on Block LayoutDrupal block layout
  3. Click on “Add Custom Block” buttonDrupal add block
  4. Fill the “Description” and click the source button and paste search script to “Body” textarea. Select “Text Format” dropdown value “Full HTML”Drupal block description
  5. Choose the region for the block from region settings, this is the area where the search block will be visible, for this example we have chosen “header”, then click “Save”drupal blocks
  6. Congrats, you have added AddSearch search box as a new block!

Was this helpful?

Need more help?

We’re always happy to help with code or other questions you might have. Search our documentation, contact support, or connect with our sales team.