Skip to content

Commit 11ee8c9

Browse files
committed
Avoid panic on unexpected index data
1 parent ee0926d commit 11ee8c9

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

quickwit/quickwit-search/src/collector.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,12 @@ impl SortingFieldExtractorComponent {
289289
let term_dict = str_column.dictionary();
290290
let mut buffer = Vec::new();
291291
term_dict.ord_to_term(val_as_u64, &mut buffer)?;
292-
SortValue::Str(
293-
String::from_utf8(buffer).expect("could not convert to String"),
294-
)
292+
let string_value = String::from_utf8(buffer).map_err(|_| {
293+
tantivy::TantivyError::InternalError(format!(
294+
"term dictionary contains non-UTF-8 bytes"
295+
))
296+
})?;
297+
SortValue::Str(string_value)
295298
}
296299
}
297300
}

0 commit comments

Comments
 (0)