chore(search): rename in the search endpoint

Fix ##2376
This commit is contained in:
Irevoire 2022-05-18 13:17:56 +02:00 committed by Tamo
parent ae4e419db4
commit 4e9accdeb7
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
6 changed files with 50 additions and 67 deletions

View file

@ -363,7 +363,7 @@ pub struct SearchAggregator {
highlight_pre_tag: bool,
highlight_post_tag: bool,
crop_marker: bool,
matches: bool,
show_matches_position: bool,
crop_length: bool,
}
@ -419,7 +419,7 @@ impl SearchAggregator {
ret.highlight_post_tag = query.highlight_post_tag != DEFAULT_HIGHLIGHT_POST_TAG;
ret.crop_marker = query.crop_marker != DEFAULT_CROP_MARKER;
ret.crop_length = query.crop_length != DEFAULT_CROP_LENGTH;
ret.matches = query.matches;
ret.show_matches_position = query.show_matches_position;
ret
}
@ -472,7 +472,7 @@ impl SearchAggregator {
self.highlight_pre_tag |= other.highlight_pre_tag;
self.highlight_post_tag |= other.highlight_post_tag;
self.crop_marker |= other.crop_marker;
self.matches |= other.matches;
self.show_matches_position |= other.show_matches_position;
self.crop_length |= other.crop_length;
}
@ -515,7 +515,7 @@ impl SearchAggregator {
"highlight_pre_tag": self.highlight_pre_tag,
"highlight_post_tag": self.highlight_post_tag,
"crop_marker": self.crop_marker,
"matches": self.matches,
"show_matches_position": self.show_matches_position,
"crop_length": self.crop_length,
},
});

View file

@ -36,8 +36,8 @@ pub struct SearchQueryGet {
filter: Option<String>,
sort: Option<String>,
#[serde(default = "Default::default")]
matches: bool,
facets_distribution: Option<String>,
show_matches_position: bool,
facets: Option<String>,
#[serde(default = "default_highlight_pre_tag")]
highlight_pre_tag: String,
#[serde(default = "default_highlight_post_tag")]
@ -60,8 +60,8 @@ impl From<SearchQueryGet> for SearchQuery {
.attributes_to_highlight
.map(|attrs| attrs.split(',').map(String::from).collect());
let facets_distribution = other
.facets_distribution
let facets = other
.facets
.map(|attrs| attrs.split(',').map(String::from).collect());
let filter = match other.filter {
@ -84,8 +84,8 @@ impl From<SearchQueryGet> for SearchQuery {
attributes_to_highlight,
filter,
sort,
matches: other.matches,
facets_distribution,
show_matches_position: other.show_matches_position,
facets,
highlight_pre_tag: other.highlight_pre_tag,
highlight_post_tag: other.highlight_post_tag,
crop_marker: other.crop_marker,
@ -169,10 +169,6 @@ pub async fn search_with_url_query(
let search_result = search_result?;
// Tests that the nb_hits is always set to false
#[cfg(test)]
assert!(!search_result.exhaustive_nb_hits);
debug!("returns: {:?}", search_result);
Ok(HttpResponse::Ok().json(search_result))
}
@ -207,10 +203,6 @@ pub async fn search_with_post(
let search_result = search_result?;
// Tests that the nb_hits is always set to false
#[cfg(test)]
assert!(!search_result.exhaustive_nb_hits);
debug!("returns: {:?}", search_result);
Ok(HttpResponse::Ok().json(search_result))
}