meilisearch / meilisearch-rust

Rust wrapper for the Meilisearch API.

Home Page:https://www.meilisearch.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error parsing response JSON for facetStats

Vedmak opened this issue · comments

commented

Description
If response from Mailisearch contains facetStats (facet field must contain numeric values to make it happen), sdk returns error. It seems it happens because FacetStats struct is defined with whole number field types. But meilisearch response json contains floats. Changing u32 to f64 fixes this problem.

pub struct FacetStats {
    pub min: u32,
    pub max: u32,
}

Expected behavior
No error should happen.

Current behavior
Error parsing response JSON returned

Environment (please complete the following information):

  • OS: Linux
  • Meilisearch version: 1.1
  • meilisearch-rust version: 0.23.1

Hey @Vedmak, thanks a lot for raising this. Tests should have covered that. Could you open a PR with the changes? If you have no time no worries.