We had an issue when using Solr and finding autocomplete suggestions with words containing diacritics such as åäö. Our solr is configured to remove all special characters through transliteration when building the index. I couldn't find a way to configure transliteration for the autocomplete search on facet.prefix so I simply ran Drupals own transliteration module on the search key first. It works great and here's a simple patch :)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

esbite’s picture

Status: Active » Needs review
FileSize
445 bytes

Filename should have been #1, didn't understand it would actually make a comment when editing the subject :)

drunken monkey’s picture

Version: 7.x-1.6 » 7.x-1.x-dev
FileSize
1.75 KB

Hm, yes, it's tricky, currently we need to more or less duplicate Solr's own processing/tokenizing in Drupal to make autocompletion work properly. Maybe #2348973: Add suggester support for the autocomplete functionality would be a general solution for this problem, but currently I guess we need to make do.
So, your patch seems like a reasonable solution for that particular problem. It might not be what some people want, though, so I'd say we should make it configurable.

Patch attached, please enable the "Transliterate user input" option for the server and then verify this still works as desired.

drunken monkey’s picture

Revised patch, displaying the option only if transliteration is even available.

esbite’s picture

I have to redact my earlier comment and patch, it worked for that specific problem, but we have now removed it from production.

When further developing our search feature we also had two other issues with autocomplete, it included punctuation in suggestions, and it used stemming of words creating strange things in Swedish which we didn't want. When solving those issues we also solved the issue with diacritics and had to disable this patch.

Instead of using the default Solr settings we created an aggregate field in Search API and are now using only that field for autocomplete. We've then set specific configurations for that field in Solr so that it handles transliteration and tokenizing differently.

We found a helpful guide in this comment:
https://www.drupal.org/node/2091995#comment-8402883

OanaIlea’s picture

Status: Needs review » Closed (outdated)

This issue was closed due to lack of activity over a long period of time. If the issue is still acute for you, feel free to reopen it and describe the current state.