What are the Slack Archives?
Itβs a history of our time together in the Slack Community! Thereβs a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you wonβt be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Good morning π To introduce *autocompletion* for *Elasticsearch* queries, we: β’ use `Completion
Good morning π
To introduce autocompletion for Elasticsearch queries, we:
β’ use CompletionQueryExpanderPlugin
and CompletionResultFormatterPlugin
in the CatalogDependencyProvider
Β
β’ use edge-ngram
as filter in page.json
to provide the starting tokens of our words from the index β> this works fine π
β’ Spryker docs say that the completion words will be picked from the completion_terms
field in page.json
: but we donβt have such a field, instead the completion terms are being picked from the index as expected (because we have edge-ngram) β
To introduce spelling suggestion, we:
β’ use SpellingSuggestionQueryExpanderPlugin
and SpellingSuggestionResultFormatterPlugin
in the CatalogDependencyProvider
β’ Spryker docs say that all suggestions will be picked from the suggestion_terms
field in page.json
-> can we avoid this and pick from the index instead?
β’ can we not specify sth (e.g. fuzzy
) in page.json
to get spelling suggestions from the index β π
Comments
-
I'm not sure what you mean by from the index but I guess you are referring to the full_text and full_text_boosted fields.
You should be careful with completions though. The idea is that these are extremely fast to provide almost instant feedback to the user. This is why Elasticsearch provides a special strategy for this:
https://www.elastic.co/guide/en/elasticsearch/reference/7.12/search-suggesters.html#completion-suggester
Spryker is making use of that by providing the completion_terms field (as far as I know)The approach is very similar for providing spelling suggestions:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html0 -
Iβm also not sure what i mean with from the index π
(i think itβs the magic Elasticsearch index that maps words from documents to the related document-id (and the wordβs frequency)).
I thought there was a possibility to get spelling suggestions directly from the index and not from a field in thepage.json
because maybe thesuggestion_terms
are not complete while the index is complete.
The Elasticsearch docs refer to it here https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html#fuzzy, but I think I understand now: for fuzzy queries, they donβt suggest corrected terms but just return corrected results.
So, I guess I have to add thesuggestion_terms
list if I want to have spelling suggestions.0 -
I guess,
suggestion_terms
should be added like this inpage.json
?"mappings": { "page": { "properties": { "full-text": { (...) }, "full-text-boosted": { (...) }, "search_data": { "suggestion_terms": { "type": "string", "index_analyzer": "term_suggestion_analyzer", "search_analyzer": "lowercase_analyzer" } } } }
I donβt need to provide the actual spelling suggestions, right?
"suggestion_terms": { "type": "string", "suggestion_terms": ["hammer", "radio", "sofa"]
0 -
Correct, you don't. Albeit the results can sometimes be a bit weird since Elasticsearch determines the suggestions from the terms it knows and they are not always suitable.
I think Spryker provides all the necessary plugins out of the box so you don't need to manually add a new field to your page document.0 -
Yes, I see that now, itβs all there π
The query already returns suggestions in case of a typo: Iβll just call CatalogController again in this case now, so the results for the suggested term are being displayed immediately.0 -
Nice, I'm happy you got it to work
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 930 Developer Corner
- 788 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K π Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random