mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-10-08 04:42:41 +00:00
chore: tiebreaker cleanup
This commit is contained in:
@@ -30,9 +30,10 @@ pub(crate) fn serialize_generated_tie_breaker_column(
|
||||
num_docs: u32,
|
||||
output: &mut impl Write,
|
||||
) -> io::Result<()> {
|
||||
let max_start = i64::from(i32::MAX) - i64::from(num_docs.saturating_sub(1));
|
||||
let start = rand::rng().random_range(i64::from(i32::MIN)..=max_start);
|
||||
let end = start + i64::from(num_docs);
|
||||
// TODO: Lift this temporary i32 limit once downstream consumers support the full i64 range.
|
||||
let max_start = i32::MAX as i64 - num_docs as i64;
|
||||
let start: i64 = rand::rng().random_range(i32::MIN as i64..=max_start);
|
||||
let end = start + num_docs as i64;
|
||||
let values = start..end;
|
||||
let column_index_num_bytes = serialize_column_index(SerializableColumnIndex::Full, output)?;
|
||||
serialize_u64_based_column_values(
|
||||
|
||||
@@ -93,7 +93,9 @@ fn column_dictionary_prefix_for_subpath(root_path: &str) -> String {
|
||||
impl ColumnarReader {
|
||||
/// Opens a new Columnar file.
|
||||
pub fn open<F>(file_slice: F) -> io::Result<ColumnarReader>
|
||||
where FileSlice: From<F> {
|
||||
where
|
||||
FileSlice: From<F>,
|
||||
{
|
||||
Self::open_inner(file_slice.into())
|
||||
}
|
||||
|
||||
@@ -250,8 +252,6 @@ mod tests {
|
||||
panic!("expected an i64 tie-breaker column");
|
||||
};
|
||||
assert_eq!(column.index.get_cardinality(), crate::Cardinality::Full);
|
||||
assert!(column.first(0).unwrap() >= i64::from(i32::MIN));
|
||||
assert!(column.first(1_024).unwrap() <= i64::from(i32::MAX));
|
||||
for doc in 1..1_025 {
|
||||
assert_eq!(column.first(doc), Some(column.first(doc - 1).unwrap() + 1));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user