diff --git a/src/common/bitpacker.rs b/src/common/bitpacker.rs index 49ea9f9e6..7d7aeb23c 100644 --- a/src/common/bitpacker.rs +++ b/src/common/bitpacker.rs @@ -15,7 +15,7 @@ use std::ops::Deref; /// reasons, we want to ensure that a value spawns over at most 8 bytes /// of aligns bytes. /// -/// Spawning over 9 bytes is possible for instance, if we do +/// Spanning over 9 bytes is possible for instance, if we do /// bitpacking with an amplitude of 63 bits. /// In this case, the second int will start on bit /// 63 (which belongs to byte 7) and ends at byte 15; diff --git a/src/fastfield/reader.rs b/src/fastfield/reader.rs index aae1dd797..06190b111 100644 --- a/src/fastfield/reader.rs +++ b/src/fastfield/reader.rs @@ -1,20 +1,17 @@ use std::io; use std::collections::HashMap; use directory::ReadOnlySource; -use common::BinarySerializable; +use common::{self, BinarySerializable}; +use common::bitpacker::{compute_num_bits, BitUnpacker}; use DocId; use schema::{Field, SchemaBuilder}; use std::path::Path; use schema::FAST; use directory::{WritePtr, RAMDirectory, Directory}; -use fastfield::FastFieldSerializer; -use fastfield::FastFieldsWriter; -use common::bitpacker::compute_num_bits; -use common::bitpacker::BitUnpacker; +use fastfield::{FastFieldSerializer, FastFieldsWriter}; use schema::FieldType; use error::ResultExt; use std::mem; -use common; use owning_ref::OwningRef; /// Trait for accessing a fastfield. @@ -212,7 +209,7 @@ impl FastFieldReader for I64FastFieldReader { let output_u64: &mut [u64] = unsafe { mem::transmute(output) }; self.underlying.get_range(start, output_u64); for mut_val in output_u64.iter_mut() { - *mut_val ^= 1 << 63; + *mut_val = common::u64_to_i64(*mut_val as u64) as u64; } } diff --git a/src/postings/docset.rs b/src/postings/docset.rs index ea4211a5f..22fa3d9f3 100644 --- a/src/postings/docset.rs +++ b/src/postings/docset.rs @@ -52,6 +52,18 @@ pub trait DocSet { } } + fn fill_buffer(&mut self, buffer: &mut [DocId]) -> bool { + for buffer_val in buffer.iter_mut() { + if self.advance() { + *buffer_val = self.doc(); + } + else { + return false; + } + } + return true; + } + /// Returns the current document fn doc(&self) -> DocId; diff --git a/src/query/query.rs b/src/query/query.rs index f091442a8..683281dc6 100644 --- a/src/query/query.rs +++ b/src/query/query.rs @@ -58,10 +58,8 @@ pub trait Query: fmt::Debug { /// - iterate throw the matched documents and push them to the collector. /// fn search(&self, searcher: &Searcher, collector: &mut Collector) -> Result { - let mut timer_tree = TimerTree::default(); let weight = try!(self.weight(searcher)); - { let mut search_timer = timer_tree.open("search"); for (segment_ord, segment_reader) in searcher.segment_readers().iter().enumerate() {