mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
Change crop_length type from Option(usize) to usize
This commit is contained in:
parent
638009fb2b
commit
65130d9ee7
@ -22,8 +22,8 @@ const fn default_search_limit() -> usize {
|
||||
}
|
||||
|
||||
pub const DEFAULT_CROP_LENGTH: usize = 200;
|
||||
const fn default_crop_length() -> Option<usize> {
|
||||
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<HashSet<String>>,
|
||||
pub attributes_to_crop: Option<Vec<String>>,
|
||||
#[serde(default = "default_crop_length")]
|
||||
pub crop_length: Option<usize>,
|
||||
pub crop_length: usize,
|
||||
pub attributes_to_highlight: Option<HashSet<String>>,
|
||||
pub matches: Option<bool>,
|
||||
pub filter: Option<Value>,
|
||||
@ -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(':');
|
||||
|
@ -23,7 +23,7 @@ pub struct SearchQueryGet {
|
||||
limit: Option<usize>,
|
||||
attributes_to_retrieve: Option<String>,
|
||||
attributes_to_crop: Option<String>,
|
||||
crop_length: Option<usize>,
|
||||
crop_length: usize,
|
||||
attributes_to_highlight: Option<String>,
|
||||
filter: Option<String>,
|
||||
matches: Option<bool>,
|
||||
|
Loading…
Reference in New Issue
Block a user