search_api_synonym
INTRODUCTION
This module let editors or administrators manage synonyms and spelling errors for Search API
directly in Drupal.
The module support automated export of synonyms using cron or manual using Drupal Console or Drush.
The module it self is NOT deploying exported synonyms and spelling errors to Solr or other search backends. This can be automated using a shell script or similar. Automated deployment using Solr API integration is in development.
The module support the synonyms.txt format used in Apache Solr.
Other formats can be added using the Export plugin annotation.
REQUIREMENTS
- No requirements.
BRANCHES
The 2.x branch should be considered legacy. The current 3.x branch is for D10+, for compatibility with Drupal 11.
New features will be targeted on the 3.x branch moving forward. As of beta2, the 3.x functionality is largely the same as 2.x, so if the module is working well for you on <= D10 stick with 2.x.
INSTALLATION
Install as you would normally install a contributed drupal module. See: https://www.drupal.org/documentation/install/modules-themes/modules-8 for further information.
MANAGE SYNONYMS
After installation can you start managing your synonyms and spelling errors
at admin/config/search/search-api-synonyms.
EXPORT SYNONYMS
Drupal Console
Export synonyms using the Drupal Console command:
drupal searchapi:synonym:export
Execute the command with --help to see the different options.
Drush 8 and previous versions
Export synonyms using the Drush command:
drush search-api-synonym-export
drush sapi-syn-ex
Drush 9 (only in git repo and dev releases after 2nd of April 2018)
Export synonyms using the Drush command:
drush search-api-synonym:export
drush sapi-syn:export
drush sapi-syn-ex
Examples
Replace [COMMAND] with one of the above Drupal Console / Drush commands.
Export all Danish synonyms and spelling errors in the Solr format.
[COMMAND] --plugin=solr --langcode=da
Export all Danish spelling errors in the Solr format.
[COMMAND] --plugin=solr --langcode=da --type=spelling_error
Export all Danish synonyms without white spaces in the Solr format.
[COMMAND] --plugin=solr --langcode=da --type=synonym --filter=nospace
Cron
Export using Drupal cron is supported. See the settings in /admin/config/search/search-api-synonyms/settings.
IMPORT SYNONYMS
Synonyms can be imported as Synonym entities in Drupal using the import function in the synonym administration in Drupal.
At the moment is simple CSV, JSON and Solr (synonyms.txt) formats available. Example files can be downloaded from the import form. Choose a format and then download the example file.
Import files are expected to be in UTF-8!
DEVELOPERS
The Search API Synonym module provides the following ways for developers to
extend the functionality:
Plugins
Export plugin - see the annotation and the Solr plugin:
- Drupal\search_api_synonym\Annotation\SearchApiSynonymExport
- Drupal\search_api_synonym\Plugin\search_api_synonym\export\Solr
Import plugin - see the annotation and the CSV plugin:
- Drupal\search_api_synonym\Annotation\SearchApiSynonymImport
- Drupal\search_api_synonym\Plugin\search_api_synonym\import\CSV
SPONSORS
- FFW - https://ffwagency.com
MAINTAINERS
Current maintainers: