mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-28 01:01:00 +00:00
Return the correct response JSON object from the facet-search route
This commit is contained in:
committed by
Louis Dureuil
parent
893592c5e9
commit
93f30e65a9
@ -257,7 +257,7 @@ impl<'a> SearchForFacetValue<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn execute(&self) -> Result<Vec<FacetSearchResult>> {
|
||||
pub fn execute(&self) -> Result<Vec<FacetValueHit>> {
|
||||
let index = self.search_query.index;
|
||||
let rtxn = self.search_query.rtxn;
|
||||
|
||||
@ -304,7 +304,7 @@ impl<'a> SearchForFacetValue<'a> {
|
||||
};
|
||||
let count = search_candidates.intersection_len(&docids);
|
||||
if count != 0 {
|
||||
result.push(FacetSearchResult { value: value.to_string(), count });
|
||||
result.push(FacetValueHit { value: value.to_string(), count });
|
||||
length += 1;
|
||||
}
|
||||
if length >= MAX_NUMBER_OF_FACETS {
|
||||
@ -327,7 +327,7 @@ impl<'a> SearchForFacetValue<'a> {
|
||||
};
|
||||
let count = search_candidates.intersection_len(&docids);
|
||||
if count != 0 {
|
||||
result.push(FacetSearchResult { value: value.to_string(), count });
|
||||
result.push(FacetValueHit { value: value.to_string(), count });
|
||||
length += 1;
|
||||
}
|
||||
if length >= MAX_NUMBER_OF_FACETS {
|
||||
@ -341,8 +341,8 @@ impl<'a> SearchForFacetValue<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
pub struct FacetSearchResult {
|
||||
#[derive(Debug, Clone, serde::Serialize, PartialEq)]
|
||||
pub struct FacetValueHit {
|
||||
/// The original facet value
|
||||
pub value: String,
|
||||
/// The number of documents associated to this facet
|
||||
|
Reference in New Issue
Block a user