diff --git a/meilisearch-http/src/index/search.rs b/meilisearch-http/src/index/search.rs index acabcf46d..7e93b7099 100644 --- a/meilisearch-http/src/index/search.rs +++ b/meilisearch-http/src/index/search.rs @@ -22,8 +22,8 @@ const fn default_search_limit() -> usize { } pub const DEFAULT_CROP_LENGTH: usize = 200; -const fn default_crop_length() -> Option { - Some(DEFAULT_CROP_LENGTH) +const fn default_crop_length() -> usize { + DEFAULT_CROP_LENGTH } #[derive(Deserialize)] @@ -36,7 +36,7 @@ pub struct SearchQuery { pub attributes_to_retrieve: Option>, pub attributes_to_crop: Option>, #[serde(default = "default_crop_length")] - pub crop_length: Option, + pub crop_length: usize, pub attributes_to_highlight: Option>, pub matches: Option, pub filter: Option, @@ -133,7 +133,7 @@ impl Index { let mut ids_length_crop = HashMap::new(); for attribute in attributes { let mut attr_name = attribute.clone(); - let mut attr_len = query.crop_length; + let mut attr_len = Some(query.crop_length); if attr_name.contains(':') { let mut split = attr_name.rsplit(':'); diff --git a/meilisearch-http/src/routes/search.rs b/meilisearch-http/src/routes/search.rs index 8489215e7..c2c83e3c8 100644 --- a/meilisearch-http/src/routes/search.rs +++ b/meilisearch-http/src/routes/search.rs @@ -23,7 +23,7 @@ pub struct SearchQueryGet { limit: Option, attributes_to_retrieve: Option, attributes_to_crop: Option, - crop_length: Option, + crop_length: usize, attributes_to_highlight: Option, filter: Option, matches: Option,