mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-10-29 14:57:10 +00:00
bbb
This commit is contained in:
@@ -2,3 +2,4 @@ target
|
||||
target/debug
|
||||
target/release
|
||||
Cargo.lock
|
||||
.DS_Store
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -47,11 +47,9 @@ impl<Rec: Recorder> TermPostingsWriter<Rec> {
|
||||
}
|
||||
|
||||
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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user