meilisearch-rust
meilisearch-rust copied to clipboard
`formatted_result` handling
Should be done once https://github.com/meilisearch/meilisearch-rust/pull/201 is merged
Since v0.24.0, MeiliSearch does not return the exact document in the _formatted object.
Example With this document
[
{ "id": 1, "title": "Alice In Wonderland", "author": "Lewis Carroll", "genre": "fantasy", "price": 25.99 },
]
and this search
{
"q": "25",
"attributesToHighlight": ["*"]
}
I get:
{
"hits": [
{
"id": 1,
"title": "Alice In Wonderland",
"author": "Lewis Carroll",
"genre": "fantasy",
"price": 25.99,
"_formatted": {
"id": "1",
"title": "Alice In Wonderland",
"author": "Lewis Carroll",
"genre": "fantasy",
"price": "<em>25</em>.99"
}
}
],
"nbHits": 1,
"exhaustiveNbHits": false,
"query": "",
"limit": 20,
"offset": 0,
"processingTimeMs": 1
}
It means formatted_result (in src/search.rs) cannot be a Option<T> anymore.
I replaced it with Option<Map<String, Value>> in this PR https://github.com/meilisearch/meilisearch-rust/pull/205
Maybe there is a better solution to handle this.