Setup Drupal 8 Acquia Search on Acquia Cloud Site Factory
Drupal 8 Acquia search provides a blazing full text search experience to the end users.
To set up the Acquia search on Acquia Cloud Site Factory (ACSF), follow the below steps sequentially:
- Add the following code at \factory-hooks\post-settings-php\includes.php.
<?php/*** @file* Example implementation of ACSF post-settings-php hook.** @see https://docs.acquia.com/site-factory/tiers/paas/workflow/hooks*/// Set config directories to default location.$config_directories['vcs'] = '../config/default';$config_directories['sync'] = '../config/default';$config['search_api_solr.settings']['site_hash'] = $GLOBALS['gardens_site_settings']['conf']['acsf_db_name'];if (isset($_ENV['AH_SITE_ENVIRONMENT'])) { if ($_ENV['AH_SITE_ENVIRONMENT'] == 'dev') { $config['acquia_search.settings']['connection_override'] = [ 'scheme' => 'https', 'port' => 443, 'host' => 'zone.acquia-search.com', 'index_id' => 'XXXX-XXXXXX.dev.default', 'derived_key' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', ]; } elseif ($_ENV['AH_SITE_ENVIRONMENT'] == 'test') { $config['acquia_search.settings']['connection_override'] = [ 'scheme' => 'https', 'port' => 443, 'host' => 'zone.acquia-search.com', 'index_id' => 'XXXX-XXXXXX.test.default', 'derived_key' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', ]; } elseif ($_ENV['AH_SITE_ENVIRONMENT'] == 'live') { $config['acquia_search.settings']['connection_override'] = [ 'scheme' => 'https', 'port' => 443, 'host' => 'zone.acquia-search.com', 'index_id' => 'XXXX-XXXXXX', 'derived_key' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', ]; }}
Note: host, index_id & derived_key will get by raising the support ticket in Acquia. Acquia team will provide the key values only. Refer below screengrab
2. Download the following modules:
- Acquia Connector (https://www.drupal.org/project/acquia_connector)
- Search API (https://www.drupal.org/project/search_api)
- Search API Solr Search https://www.drupal.org/project/search_api_solr)
Install the downloaded modules along with Acquia Search module. Refer below screengrab:
3. Set up Acquia connector settings at <domain.com>/admin/config/system/acquia-connector. Refer below screengrab:
4. Configure the Search API for the functioning of Acquia search. This includes two major steps
- Add search Server
- Setup Search Index
5. Add Search Server
- Go to configuration > Search API and click on “+ Add server”
- Input Server name as per your choice
- Select Acquia Solr Connector, please ignore the error which will prompt on the screen.
- Click on “Save” button.
Refer below screengrab:
6. Configure Search Index
- Go to configuration > Search API and click on “+ Add index”
- Add Search Index name
- Select “content” Datasources.
- Select “Acquia Search API Solr server” Server from the options.
- Click on “Save and add fields”
Refer below screengrab:
- Now add fields that would like to cover in search results. Refer below screengrab:
- Select the processors that would like to enable and click “Save” button. Refer below screengrab:
After Setting up Server and index, following screen will appear with the right tick sign.
7. Indexed content
- Go to Configuration > Search API > Acquia Solr Search index.
- Click on “Index now” button.
Refer below screengrab:
8. Search result view page
- Go to Structure > Views > Acquia Search
This is default view page for search result
Congratulations! You have just configured the Acquia search successfully.
Any feedback is welcome and appreciated!!