Skip to content

Commit

Permalink
Do not use Option for universe (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyb0807 authored Jan 2, 2025
1 parent 2cc9ffd commit f811b4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rs/compression/src/compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use memmap2::Mmap;

pub trait IntSeqEncoder {
/// Creates an encoder
fn new_encoder(universe: Option<usize>, num_elem: usize) -> Self
fn new_encoder(universe: usize, num_elem: usize) -> Self
where
Self: Sized;

Expand Down
2 changes: 1 addition & 1 deletion rs/compression/src/noc/noc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl PlainEncoder {
}

impl IntSeqEncoder for PlainEncoder {
fn new_encoder(_universe: Option<usize>, num_elem: usize) -> Self {
fn new_encoder(_universe: usize, num_elem: usize) -> Self {
Self::new(num_elem)
}

Expand Down
5 changes: 4 additions & 1 deletion rs/index/src/ivf/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ impl<Q: Quantizer, C: IntSeqEncoder + 'static> IvfWriter<Q, C> {
.get(i as u32)?
.iter()
.collect::<Vec<_>>();
let mut encoder = C::new_encoder(/*universe*/ None, posting_list.len());
let mut encoder = C::new_encoder(
*posting_list.last().unwrap_or(&0) as usize,
posting_list.len(),
);
// Encode to get the length of the encoded data
encoder.encode(&posting_list)?;
// Write the length of the encoded posting list
Expand Down

0 comments on commit f811b4c

Please sign in to comment.