diff --git a/.gitignore b/.gitignore index 4a4a9c099..d9544bcb9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ target target/debug target/release Cargo.lock +.DS_Store diff --git a/src/postings/recorder.rs b/src/postings/recorder.rs index 8573180e7..e90d31ae1 100644 --- a/src/postings/recorder.rs +++ b/src/postings/recorder.rs @@ -18,13 +18,13 @@ impl Recorder for NothingRecorder { NothingRecorder } - fn record_position(&mut self, position: u32) { + fn record_position(&mut self, _position: u32) { } fn close_doc(&mut self,) { } - fn get_tf_and_posdeltas(&self, i: usize) -> (u32, &[u32]) { + fn get_tf_and_posdeltas(&self, _: usize) -> (u32, &[u32]) { (0u32, &EMPTY_ARRAY) } } @@ -43,7 +43,7 @@ impl Recorder for TermFrequencyRecorder { } } - fn record_position(&mut self, position: u32) { + fn record_position(&mut self, _position: u32) { self.current_tf += 1; } diff --git a/src/postings/serializer.rs b/src/postings/serializer.rs index ba7a86fae..70b483ce1 100644 --- a/src/postings/serializer.rs +++ b/src/postings/serializer.rs @@ -103,7 +103,7 @@ impl PostingsSerializer { if self.is_positions_enabled { self.position_deltas.extend_from_slice(position_deltas); } - if self.doc_ids.len() == 128 { + if self.doc_ids.len() == NUM_DOCS_PER_BLOCK { { // encode the positions let block_encoded: &[u32] = self.block_encoder.encode_sorted(&self.doc_ids); diff --git a/src/postings/writer.rs b/src/postings/writer.rs index d14e75bd7..1cb7701a2 100644 --- a/src/postings/writer.rs +++ b/src/postings/writer.rs @@ -47,11 +47,9 @@ impl TermPostingsWriter { } pub fn serialize(&self, serializer: &mut PostingsSerializer) -> io::Result<()> { - let mut positions_idx = 0; for (i, doc) in self.doc_ids.iter().enumerate() { let (term_freq, position_deltas) = self.recorder.get_tf_and_posdeltas(i); try!(serializer.write_doc(doc.clone(), term_freq, position_deltas)); - positions_idx += term_freq as usize; } Ok(()) }