Problem/Motivation
Using certain Search API index processors are not working on proper way. Certain processors are e.g. Stemmer, Stopwords.
Steps to reproduce
1. Create a node with title talking
2. Create new Search API (Elasticsearch) index using content as datasource.
3. Add title field on index fields. /admin/config/search/search-api/index/INDEX_NAME/fields
4. Add Tokenizer and Stemmer processors. Make sure Tokenizer is before Stemmer. /admin/config/search/search-api/index/INDEX_NAME/processors
5. Clear the index and Index the content on /admin/config/search/search-api/index/INDEX_NAME
6. On Elasticsearch the title field is stored as talk not talking.
Proposed resolution
Many possible resolutions:
1. Use native Elasticsearch stemmer filters/analyzers. https://www.drupal.org/project/search_api_elasticsearch_synonym and https://www.drupal.org/project/elasticsearch_connector_autocomp use EventSubscriberInterface to properly utilize analyzers.
2. Document that Search API Stemmer and Stopwords do not work as expected when using Elasticsearch.
3. Disable Stemmer checkbox on Elasticsearch based indexes on /admin/config/search/search-api/index/INDEX_NAME/processors.
Remaining tasks
1. Decide best approach.
2. Implement solution.
User interface changes
-
API changes
-
Data model changes
-
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3180440-3.patch | 749 bytes | sokru |
| #2 | 3180440-2.patch | 1.21 KB | sokru |
Comments
Comment #2
sokru commentedChose the easiest solution and used form_alter to add warning texts. This warning applies to all indexes, not only which backend is Elasticsearch.
Comment #3
sokru commentedActually
getDiscouragedProcessors()seems to be the proper way to implement this.search_api_solr> and https://github.com/pySilver/elasticsearch_connector use same function.Comment #4
yonailoWould not it be more useful to try to make work the processors proposed by Search API ? Is that a very difficult thing to achieve ?
Comment #6
sokru commentedCommitted the
getDiscouragedProcessorsapproach, if anyone wants to create feature using native Elasticsearch filters please create a separate issue(s) and I might be able to review them.