Drupal

Search.io integrates with Drupal via the Search API module, making it easy to add advanced search and discovery capabilities to any drupal site in minutes.

Although Drupal sites can be indexed by Crawling a website, the Search API enables instant indexing of changes made in Drupal and provides more control over what fields are being indexed.

The Search.io Search API module only implements the index syncing components of the module. To integrate a search frontend, we recommend using the Search.io React SDK.

Installation

The Search API Search.io can be installed via the standard drupal module installation process. We recommend using Composer, assuming you're already managing your project with Composer.

Enter the following command in the terminal at the root of your site:

composer update drupal/search_api_sajari

Composer will install the Search API Search.io module along with the required dependencies. Once installed, you'll need to ensure the module has been enabled. Go to http://your-drupal-domain.com/en/admin/modules (replace your-drupal-domain.com with your ) and locate the Search API Search.io module in the Search section. Enable the module if it's not already enable.

Configuration

Adding your Search.io account

Although not strictly a "Server", click Add server to add your Search.io account. If you don't have an account yet, head over to http://search.io and sign up before you continue.

  • Click Add server.

  • Provide a Server name, we recommend to keep it simple and call it Search.io.

  • Ensure the Enabled checkbox is checked.

  • Specify the Base URL. This is the base url of your drupal site (eg. http://your-drupal-domain.com).

  • Enter the Key ID and secret from your Search.io credentials page.

  • Enter the Collection ID to use. If no collection exists with this name, the collection will be created for you.

  • Save your server settings.

Adding the index

Now that the connection to your Search.io account is set up, you will need to specify which fields to index.

  • Click Add index.

  • Specify an Index name (eg. content-index).

  • Specify the Datasources, the Drupal entities you want to store in this index.

  • (Optional) Configure the data sources

  • Ensure you select Search.io (if this is the name you chose for the Server) as the Server. This ensures the entities will be stored in the Search.io index.

  • Save your index settings.

Add fields

Once you save your index settings, you will be asked to specify the fields you want to index.

  • Click Add on the fields you want to use for search or as filters.

  • Click Done.

Once you've added the fields, you will be asked to configure the data types. The Search.io Search API module will do it's best to automatically detect the data type (eg. String or Integer), but we recommend to double check the configuration. In additional to the data type, there are a few other options that can be configured for each field.

  • Search.io Array - If the represents a list, for example a list of tags, ensure this option is selected.

  • Search.io Indexed - Select this option if this field should be searchable.

  • Search.io Autocomplete - Use this field to train the autocomplete suggestions in Search.io. Generally you want to restrict this to shorter fields such as titles, topics, categories etc.

  • Search.io Mode - Select if the field should be Optional, Required or Unique. Records that don't meet the criteria selected are rejected during the indexing process.

Once all fields are configured click Save changes at the bottom of the page.

Indexing

Generally indexing happens automatically, but you can review the status of your index in the View tab. This view also provides a number of useful functions.

  • Index now - to trigger the indexing of items in the queue

  • Queue all items for reindexing - this is useful when adding additional fields to the index. Unless all records are reindexed, the data from the new field will not be available in the index.

  • Clear all indexed data - use this when you remove content types to ensure they are deleted from the index.

  • Rebuilt tracking information - The complete information about existing and indexed items for this index will be deleted and rebuilt.

When an indexed content type in Drupal changes, the changes will automatically be queued and indexed. This process happens almost instantly. To verify whether content has been successfully indexed, follow the guide on Previewing results.

Last updated