H_R1
(H R)
1
I’m considering migrating our Algolia search database to Atlas. I’ve read through most (all?) of the relevant documentation and I’m either missing/misunderstanding how to highlight properly or it’s a missing feature that Mongo Atlas cannot replicate. If anyone can clarify then thank you in advance.
Relevant documentation: https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/#highlighting-example
This shows that the example query results have the entire ‘path’ highlighted. The issue with this is that highlighting everything is as effective as highlighting nothing:
Example query of ‘Ger’ from the docs:
Is there a way to get just the ‘Ger’ as a highlight ‘hit’. E.g. of expected result (that could be shown in the UI to the user in a helpful way):
{
"title": "Gertie the Dinosaur",
"score": 6.0822906494140625,
"highlights": [
{
"score": 0.9227690100669861,
"path": "title",
"texts": [
{ "value": "Ger", "type": "hit" },
{ "value": "tie the Dinosaur", "type": "text" }
]
}
]
}
Again, thanks in advance for any guidance/help.
amyjian
(Amy)
2
Hi @H_R1 , this is the expected behavior when highlighting on autocomplete paths today – the returned “hits” will be at least maxGrams in length. We are aware that this is not ideal, and would like to improve this in the future. I suggest opening a feedback item in our portal here to track improvements.
That being said, you can play around with a custom analyzer that mimics autocomplete search behavior while retrieving partial word highlights – example here. You can configure the tokenizer, maxGram and minGram in the custom analyzer like you would for an autocomplete type.
Let me know if this helps!