Respect the submission guidelines above! Drupal.org issue forks cause additional work for the project maintainer!
Setup
- Solr version: 8.11.1
- Drupal Core version: 9.3.13
- Search API version: 1.23.0
- Search API Solr version: 4.2.7
- Configured Solr Connector: Standard
Issue
Hello,
I have problems getting the autocompletion using the suggester of solr to work. I'm posting it as a bug since I think I configured it well and it doesn't work though.
I configured it in /admin/config/search/search-api/index/solr_index/autocomplete and the only enabled suggester is the "Solr-Suggester". In the further config I restricted to the current drupal site and selected that solr should take care of the language.
In fact the suggestions are an empty every time I type in something. Also the suggest endpoint throws the error "No suggester named 10 was configured" when using the default config the module generates. After deleting the line
<str name="suggest.dictionary">10</str>
from solrconfig_extra.xml in the handler
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
it at least doesn't throw an exception.
Due to the lack of documentation I didn't get the point of the field twm_suggest which seems to be an important thing for the suggester as it's used in the suggest components:
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">en</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">twm_suggest</str>
Do I need to add it as a "field"? What's the point of it exactly?
Any help is highly appreciated!
Thanks in advance!
Bye Defcon0
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | screen.png | 106.46 KB | defcon0 |
Comments
Comment #2
mkalkbrennerThe dictionary name should be the language id. Obviously there's something wrong.
The suggester dictionary needs to be filled. You need to configure your index to index some drupal fields as "Suggester".
Comment #3
avpadernoComment #4
defcon0 commentedOK, the
<str name="suggest.dictionary">10</str>issue has already been fixed in the 4.x branch (https://git.drupalcode.org/project/search_api_solr/-/commit/1af08055e5fa...) but isn't tagged, yet in 4.2.7 which is the latest version (I composer-required it using this constraint:^4.2). Is there a reson that the latest tag is way older then the 4.x branch? Should we use the branch instead?After applying that fix manually and adding some fields as "Suggester" as you advised, the error is gone but after calling /solr/dev/suggest?q=test&wt=json I get:
I defined my fields as you can see in the screenshot attached. In the frontend I get "[]" for any query still.
Could you please point me in a direction how to debug this? Big thanks in advance!
Comment #5
defcon0 commentedAh, one step further. After manuelly changing the dictionary from "und"
to "de"
it brings up results.
Is this a bug? Maybe I misconfigured something in the plugin?
Comment #6
mkalkbrennerThe dictionary "und" is just the default. It will be overwritten by the query. It seems that this code isn't able to detect the right language and also uses the "und" fallback. I assume that you don't provide the correct language filter in your query (view).
Comment #7
mkalkbrennerNo further feedback. Feel free to re-open the issue if required.