Site Search / Drupal Connector


Setting up SearchStax Site Search for Drupal Module is an easy, step-by-step process that you can complete in just a few minutes.

This article assumes that you have already set up a Site Search App.

Basic Steps

  1. Install and Enable Required Modules
  2. Set up the Server and Index
  3. Configure the SearchStax Module
  4. Configure Fields for Search Page on Drupal (optional)
  5. Set up Site Search and Validate

Step 1: Install and Enable Required Modules

Install and enable the following modules. They are dependencies for SearchStax Site Search module. We recommend that you install the following modules using Composer.

Once the Composer commands run successfully, enable the modules by going to the Extend tab on your Drupal Admin dashboard, search for the module name, check the relevant box, and click Install.

Step 2: Set up the Server and Index

A. Click on the Configuration tab. Look for the Search and Metadata section and click on Search API to configure it.

B. Once there, click Add Server.

C. Give your server a name. Make sure the Backend is set to Solr. 

D. Configure the Server

To configure the Server, follow these steps:

  • The Solr Connector: SearchStax Cloud with Token Auth
  • The Endpoint: the Update endpoint for your Search App. The Update endpoint can be found in Site Search > App Settings > All APIs > Search & Indexing
  • The Read & Write token key: the Read & Write token for your Search App. The Read & Write Site Search token can be found in Site Search > App Settings > All APIs > Search & Indexing
  • Scroll down and click the Save button.

E. After pressing Save, your Server details should appear with a status message “The server was successfully saved”.

  • Server Connection status should read “The server could be reached.”
  • Core Connection should read “The Solr core could be accessed” with a latency reading.

F. Next, you will need to define an index. In the Search API configuration screen, click on Add Index.

G. Give your index a name, and select the data sources you wish to index. For this example, select Content. Select the Server created earlier. Click Save and add Fields.

H. Select Fields to Index. It is up to you what fields you’d like indexed. These will eventually be searched, used for faceting, and more in SearchStax Site Search. We recommend the following fields:

  • rendered_item
  • langcode
  • Status
  • uid (author)
  • Content
  • body
  • Title
  • published date

Use Fulltext Fields for Searching

Only fulltext fields are “searchable”, which means they’re able to return partial text matches.

I. Add a Processor. We recommend adding an HTML filter found in the Processor tab.

J. Manually Index Your Site: A cron job will periodically index your site automatically. If you want to see your results immediately, go to the Search API configuration screen and click on the index created earlier. At the bottom, click on the Index now button.

K. After you begin, you will see a progress bar. Once it reaches 100%, you will get a success message.

 

L. If you plan to use the Search UI App or implement Site Search directly from the APIs, see the instructions below.

Otherwise, if you have a Drupal Views page configured or native Drupal search implemented, proceed to Configure the SearchStax Module.

Step 3: Configure the SearchStax Module

Now that you have created a server and an index through Search API, the next step is to reroute your searches through SearchStax Site Search. 

Navigate to SearchStax module in your Drupal Admin – Administration > Configuration > Search and Metadata > Searchstax settings

Analytics is Optional!

This section includes instructions about entering SearchStax analytics keys. If your Site Search does not include a Site Search > App Settings > All APIs > Analytics tab, you can skip the steps about Analytics Keys.

Add configuration information. The configuration page contains the following options (subject to change):

Javascript library version: Select the most recent version of the Site Search Analytics library. As of this writing, it’s version three.

Please contact Support if you wish to use an earlier version to understand the ramifications.

Analytics URL: To find the Analytics URL your Search App uses, navigate to your SearchStax Site Search account and select the App you are configuring for. Then go to Site Search > App Settings > All APIs > Analytics. Paste the Analytics tracking URL from Site Search into the Analytics URL field.

Global analytics key: The Global Analytics Key is the key Drupal uses for all searches unless search-specific analytics keys are identified below.

To find the Analytics Tracking Key your Search App uses, navigate to your SearchStax Site Search account and select the App you are configuring. Then go to Site Search > App Settings > All APIs > Analytics. Paste the Analytics Tracking Key from Site Search into the Analytics URL field.

Search-specific analytics keys: In case you have several apps defined in Site Search, you can use this section to change the analytics key used for every single search page on your site. (If a search page is not listed here, its searches will also not be tracked!)
If you have only a single search app configured, you can safely ignore this section.

Auto-suggest core: (Only displayed if the Search API Autocomplete module is installed on your site.) If you want to use SearchStax’s auto-suggest capabilities, enter the Solr core to use in this field. You can find this under Site Search > Navigation > App Settings > Search & Indexing. The core is the last component before /emsuggest.

Do not track these roles: Choose which Drupal roles you wish to not track. In practice, Administrator, Author, and Editor should not be tracked.

Re-route searches through Site Search: To use Site Search on Drupal, this option must be checked. Instead of using native Solr (/select handler), Drupal sends all search requests to the Site Search handler (/emselect).

You can now tune your search relevancy with Search Profiles in Site Search.

Once this option is enabled, the module will make other options available.

Configure searches via Site Search: Enable this option to ignore Drupal search settings (recommended).

Enabling makes available the following options:

  • Parse mode and search fields: This option must be selected to enable powerful features in Search Profiles such as Rules and Promotions. It ensures the search query is passed in a way that the Search Profile can understand.
  • Highlighting settings: Select to have Site Search control hit highlighting instead of Drupal.
  • Spellcheck settings: Select to have Site Search control Spell Check instead of Drupal.
  • Sorts: Select this option to give Site Search control of sorting. Drupal will pass sorting as URL parameter when a search request is sent to Site Search.
  • Facets: Select this option to let Site Search decide what facets to display on the Drupal Facets module. It is not recommended unless you are an advanced user.

With all of this configured as desired, click Save configuration to complete the setup.

Step 4: Configure Fields for Search Page on Drupal (optional)

If you wish to use a Drupal Views Search page, follow these steps to set one up, if you haven’t done so already.

A. Create a Search page on Drupal by going to Structure > Views > + Add View, and selecting the Index [your_index] option from the Show dropdown menu under View settings.

B. Check the box that says Create a Page and hit Save and edit.

C. In the Search page Edit view, under the Fields section, add the Title (Indexed field) and Body (Indexed field) fields to be included in the search results. Then, click on Add and configure fields.

D. If you wish to see hit-highlighting in the results, check the box that says Use highlighted field data for each field, and hit Apply.

E. Then, add a filter under Filter criteria.

After clicking on Add and configure filter criteria, expose the newly created filter so that you are able to perform searches. Again, hit Apply and then Save for the changes to take effect.

Step 5: Set up Site Search and Validate

Follow the instructions in Your First Search to get started with SearchStax Site Search.  

Once the Site Search changes are published, go back to your Drupal Search page (if one is set up) and search for something. You should see relevant results appear for the search.

That’s it! You have now successfully set up the SearchStax Drupal module.

Questions?

Do not hesitate to contact the SearchStax Support Desk.