问题
I am using nest api and searchasyoutype datatype but the fuziness(Fuzziness.Auto) is not working Following is my code:
var searchResponse=_con.client.Search<object>(x=>x.Index("_all").Query(q=>q.MultiMatch(m=>m.Query(searchterm)
.Fuzziness(Fuzziness.Auto)
.Fields(f => f.Field("name").Field("name._2gram").Field("name._3gram"))
.Type(TextQueryType.BoolPrefix)
)));
Following result is when searchterm is correctly spelled with searchterm=washing
https://localhost:44311/api/search/suggest/?searchterm=Washing&indexname=test3
Output:
[
{
"id": "4",
"description": "Top load Washing Machine",
"name": "Whirlpool 8kg load washing machine",
"qty": "100"
}
]
But when i do with searchterm= wafhing it displays no result
https://localhost:44311/api/search/suggest/?searchterm=Wafhing&indexname=test3
Output
[]
and when search term contains two mispelled words i get the expected output:
https://localhost:44311/api/search/suggest/?searchterm=wasing achene&indexname=test3
Output:
[
{
"id": "4",
"description": "Top load Washing Machine",
"name": "Whirlpool 8kg load washing machine",
"qty": "100"
}
]
来源:https://stackoverflow.com/questions/59574757/fuzziness-functionality-not-working-for-single-word-in-my-searchasyoutype-dataty