mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +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;
|
pub const DEFAULT_CROP_LENGTH: usize = 200;
|
||||||
const fn default_crop_length() -> Option<usize> {
|
const fn default_crop_length() -> usize {
|
||||||
Some(DEFAULT_CROP_LENGTH)
|
DEFAULT_CROP_LENGTH
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
@ -36,7 +36,7 @@ pub struct SearchQuery {
|
|||||||
pub attributes_to_retrieve: Option<HashSet<String>>,
|
pub attributes_to_retrieve: Option<HashSet<String>>,
|
||||||
pub attributes_to_crop: Option<Vec<String>>,
|
pub attributes_to_crop: Option<Vec<String>>,
|
||||||
#[serde(default = "default_crop_length")]
|
#[serde(default = "default_crop_length")]
|
||||||
pub crop_length: Option<usize>,
|
pub crop_length: usize,
|
||||||
pub attributes_to_highlight: Option<HashSet<String>>,
|
pub attributes_to_highlight: Option<HashSet<String>>,
|
||||||
pub matches: Option<bool>,
|
pub matches: Option<bool>,
|
||||||
pub filter: Option<Value>,
|
pub filter: Option<Value>,
|
||||||
@ -133,7 +133,7 @@ impl Index {
|
|||||||
let mut ids_length_crop = HashMap::new();
|
let mut ids_length_crop = HashMap::new();
|
||||||
for attribute in attributes {
|
for attribute in attributes {
|
||||||
let mut attr_name = attribute.clone();
|
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(':') {
|
if attr_name.contains(':') {
|
||||||
let mut split = attr_name.rsplit(':');
|
let mut split = attr_name.rsplit(':');
|
||||||
|
@ -23,7 +23,7 @@ pub struct SearchQueryGet {
|
|||||||
limit: Option<usize>,
|
limit: Option<usize>,
|
||||||
attributes_to_retrieve: Option<String>,
|
attributes_to_retrieve: Option<String>,
|
||||||
attributes_to_crop: Option<String>,
|
attributes_to_crop: Option<String>,
|
||||||
crop_length: Option<usize>,
|
crop_length: usize,
|
||||||
attributes_to_highlight: Option<String>,
|
attributes_to_highlight: Option<String>,
|
||||||
filter: Option<String>,
|
filter: Option<String>,
|
||||||
matches: Option<bool>,
|
matches: Option<bool>,
|
||||||
|
Loading…
Reference in New Issue
Block a user