mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-02-07 19:36:26 +08:00
Return an internal error when a field id is missing
This commit is contained in:
parent
f36de2115f
commit
aadbe88048
@ -266,18 +266,24 @@ impl<'a> SearchForFacetValue<'a> {
|
|||||||
return Err(UserError::InvalidSearchFacet {
|
return Err(UserError::InvalidSearchFacet {
|
||||||
field: self.facet.clone(),
|
field: self.facet.clone(),
|
||||||
valid_fields: filterable_fields.into_iter().collect(),
|
valid_fields: filterable_fields.into_iter().collect(),
|
||||||
})?;
|
}
|
||||||
|
.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
let fields_ids_map = index.fields_ids_map(rtxn)?;
|
let fields_ids_map = index.fields_ids_map(rtxn)?;
|
||||||
let (field_id, fst) = match fields_ids_map.id(&self.facet) {
|
let fid = match fields_ids_map.id(&self.facet) {
|
||||||
Some(fid) => {
|
Some(fid) => fid,
|
||||||
match self.search_query.index.facet_id_string_fst.get(rtxn, &BEU16::new(fid))? {
|
None => {
|
||||||
Some(fst) => (fid, fst),
|
return Err(FieldIdMapMissingEntry::FieldName {
|
||||||
None => todo!("return an error, is the user trying to search in numbers?"),
|
field_name: self.facet.clone(),
|
||||||
|
process: "search for facet values",
|
||||||
}
|
}
|
||||||
|
.into());
|
||||||
}
|
}
|
||||||
None => todo!("return an internal error bug"),
|
};
|
||||||
|
let fst = match self.search_query.index.facet_id_string_fst.get(rtxn, &BEU16::new(fid))? {
|
||||||
|
Some(fst) => fst,
|
||||||
|
None => return Ok(vec![]),
|
||||||
};
|
};
|
||||||
|
|
||||||
let search_candidates = self.search_query.execute()?.candidates;
|
let search_candidates = self.search_query.execute()?.candidates;
|
||||||
@ -296,7 +302,7 @@ impl<'a> SearchForFacetValue<'a> {
|
|||||||
let mut length = 0;
|
let mut length = 0;
|
||||||
while let Some(facet_value) = stream.next() {
|
while let Some(facet_value) = stream.next() {
|
||||||
let value = std::str::from_utf8(facet_value)?;
|
let value = std::str::from_utf8(facet_value)?;
|
||||||
let key = FacetGroupKey { field_id, level: 0, left_bound: value };
|
let key = FacetGroupKey { field_id: fid, level: 0, left_bound: value };
|
||||||
let docids = match index.facet_id_string_docids.get(rtxn, &key)? {
|
let docids = match index.facet_id_string_docids.get(rtxn, &key)? {
|
||||||
Some(FacetGroupValue { bitmap, .. }) => bitmap,
|
Some(FacetGroupValue { bitmap, .. }) => bitmap,
|
||||||
None => todo!("return an internal error"),
|
None => todo!("return an internal error"),
|
||||||
@ -319,7 +325,7 @@ impl<'a> SearchForFacetValue<'a> {
|
|||||||
let mut length = 0;
|
let mut length = 0;
|
||||||
while let Some(facet_value) = stream.next() {
|
while let Some(facet_value) = stream.next() {
|
||||||
let value = std::str::from_utf8(facet_value)?;
|
let value = std::str::from_utf8(facet_value)?;
|
||||||
let key = FacetGroupKey { field_id, level: 0, left_bound: value };
|
let key = FacetGroupKey { field_id: fid, level: 0, left_bound: value };
|
||||||
let docids = match index.facet_id_string_docids.get(rtxn, &key)? {
|
let docids = match index.facet_id_string_docids.get(rtxn, &key)? {
|
||||||
Some(FacetGroupValue { bitmap, .. }) => bitmap,
|
Some(FacetGroupValue { bitmap, .. }) => bitmap,
|
||||||
None => todo!("return an internal error"),
|
None => todo!("return an internal error"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user