mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 05:14:27 +01:00
Return an empty list of results if attribute is set as filterable
This commit is contained in:
parent
e1b8fb48ee
commit
ed0ff47551
@ -14,8 +14,7 @@ use crate::error::UserError;
|
|||||||
use crate::heed_codec::facet::{FacetGroupKey, FacetGroupValue};
|
use crate::heed_codec::facet::{FacetGroupKey, FacetGroupValue};
|
||||||
use crate::score_details::{ScoreDetails, ScoringStrategy};
|
use crate::score_details::{ScoreDetails, ScoringStrategy};
|
||||||
use crate::{
|
use crate::{
|
||||||
execute_search, AscDesc, DefaultSearchLogger, DocumentId, FieldIdMapMissingEntry, Index,
|
execute_search, AscDesc, DefaultSearchLogger, DocumentId, Index, Result, SearchContext, BEU16,
|
||||||
Result, SearchContext, BEU16,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Building these factories is not free.
|
// Building these factories is not free.
|
||||||
@ -275,13 +274,9 @@ impl<'a> SearchForFacetValues<'a> {
|
|||||||
let fields_ids_map = index.fields_ids_map(rtxn)?;
|
let fields_ids_map = index.fields_ids_map(rtxn)?;
|
||||||
let fid = match fields_ids_map.id(&self.facet) {
|
let fid = match fields_ids_map.id(&self.facet) {
|
||||||
Some(fid) => fid,
|
Some(fid) => fid,
|
||||||
None => {
|
// we return an empty list of results when the attribute has been
|
||||||
return Err(FieldIdMapMissingEntry::FieldName {
|
// set as filterable but no document contains this field (yet).
|
||||||
field_name: self.facet.clone(),
|
None => return Ok(Vec::new()),
|
||||||
process: "search for facet values",
|
|
||||||
}
|
|
||||||
.into());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let fst = match self.search_query.index.facet_id_string_fst.get(rtxn, &BEU16::new(fid))? {
|
let fst = match self.search_query.index.facet_id_string_fst.get(rtxn, &BEU16::new(fid))? {
|
||||||
|
Loading…
Reference in New Issue
Block a user