Hello,
I had to enhance a project which works with ElasticSearch 7.3 (ES).
I found a problem with autocomplete when I used ngram on fulltext fields.
ES have a parameter called 'max_ngram_diff' which define the maximum difference between min_ngram and max_ngram.
But the default value is 1 and can't be changed throught Drupal. So, it's actually impossible to define for example min_gram = 3 and max_gram = 10 to say to the tokenizer to split more efficiantly.
I have added a new field into "Ngram configuration" tab, on "edit index" form to do that. After setting this new field, the parameter max_ngram_diff is passed to index configuration on ES server.
This way, autocomplete's results are more pertinents.
I propose a patch to enhance ngram configuration directly on Drupal.
Thanks !
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3082309-8.patch | 2.7 KB | ralphvdhoudt |
| #5 | Screenshot from 2020-06-09 21-38-08.png | 107.74 KB | thursday_bw |
| add-index-max-ngram-diff.patch | 1.7 KB | striknin |
Comments
Comment #2
grimreaperComment #3
thursday_bw commentedIs that backwards compatible with older versions of elasticsearch?
Also you can model or add to the existing javascript test to add some tests to that field.
This test: https://git.drupalcode.org/project/elasticsearch_connector_autocomp/-/bl...
If this is a blocker for new versions of elasticsearch then would be great to get it through.
Comment #4
thursday_bw commentedComment #5
thursday_bw commentedAs for the patch, it failes coding standards due to white space at the end of a few lines. You can see them clearly in read in this screenshot.
I can take care of those easy enough on merge, but is worth noting to avoid them in the future.
I'd love to get this through. I've been contemplating for a long time that this module may evolve into more than just ngram config.
That's a conversation for a different issue.
Comment #6
thursday_bw commentedComment #7
bartlangelaanWe have been using this patch in production for a few months now, flawlessly.
Attached is a new patch, that also contains the configuration schema for the third_party_settings.
This way, the config is formatted nicely, and no errors are shown when using config_inspector.
I have also removed the whitespace changes.
Comment #8
ralphvdhoudt commentedPath #7 added the schema, only extending the search_api.index.* schema did not work correctly
Updated the config schema to work with third_party_settings with their own config