Highlighting with fuzziness in multi_match lose one char


(Edoardo) #1

Hello,
I'm building a small research compoentent, but it will have to search through a lot of data.
I made a multi_match between different fields but with the fuzziness setting (1) to improve the search results, the highlight loses a letter.

Is it possible to avoid this?

QueryCode:

"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "test12342",
"fields": [
"otherLocales.name.edge",
"locales.IT.name.edge",
"locales.EN.name.edge"
],
"type": "best_fields",
"fuzziness": "1",
"operator": "And"
}
},
{
"terms": {
"contentType": [
"ALL"
]
}
}
]
}
},
"highlight": {
"fields": {
"otherLocales.name.edge": {
"type": "fvh",
"order": "score"
},
"locales.IT.name.edge": {
"type": "fvh",
"order": "score"
},
"locales.EN.name.edge": {
"type": "fvh",
"order": "score"
}
}
}


(Jaspreet Singh) #2

Can you show your documents, against what you are running you queries?
It is a bit hard to tell without looking at the data.


(Edoardo) #3

Ah Sorry for my forgetfulness
{
otherLocales:[{
name:"test12342",
description:" test for autocomplete"
}]
locales:{
"it":{
name:"test12342 testa",
description:" test for autocomplete"
}
}
"id":"432pi-234po-4lk34lk-lk34j"
}

the result of highlight is:
<em'> test1234 </em'>


#4

maybe you can remove "type": "fvh" in the highlight part, then you can get what you want


(Edoardo) #5

I can try. Thanks.