Reenable unit test.

Consuming CompositeWrite on Close.
This commit is contained in:
Paul Masurel
2017-08-14 23:35:09 +09:00
parent 9cb7a0f6e6
commit 38513014d5
4 changed files with 6 additions and 11 deletions

View File

@@ -27,7 +27,7 @@ impl<W: Write> CompositeWrite<W> {
&mut self.write
}
pub fn close(&mut self) -> io::Result<()> {
pub fn close(mut self) -> io::Result<()> {
let footer_offset = self.write.written_bytes();
VInt(self.offsets.len() as u64).serialize(&mut self.write)?;

View File

@@ -97,17 +97,15 @@ mod tests {
{
assert_eq!(source.len(), 35 as usize);
}
// TODO uncomment
/*
{
let fast_field_readers = FastFieldsReader::from_source(source).unwrap();
let composite_file = CompositeFile::open(source).unwrap();
let field_source = composite_file.open_read(*FIELD).unwrap();
let fast_field_reader: U64FastFieldReader =
fast_field_readers.open_reader(*FIELD).unwrap();
U64FastFieldReader::open(field_source);
assert_eq!(fast_field_reader.get(0), 13u64);
assert_eq!(fast_field_reader.get(1), 14u64);
assert_eq!(fast_field_reader.get(2), 2u64);
}
*/
}
#[test]

View File

@@ -59,7 +59,7 @@ impl FastFieldSerializer {
/// Closes the serializer
///
/// After this call the data must be persistently save on disk.
pub fn close(mut self) -> io::Result<()> {
pub fn close(self) -> io::Result<()> {
self.composite_write.close()
}
}

View File

@@ -112,7 +112,7 @@ impl InvertedIndexSerializer {
}
/// Closes the serializer.
pub fn close(mut self) -> io::Result<()> {
pub fn close(self) -> io::Result<()> {
self.terms_write.close()?;
self.postings_write.close()?;
self.positions_write.close()?;
@@ -223,9 +223,6 @@ impl<'a> FieldSerializer<'a> {
}
}
// TODO is the last term always closed?
struct PostingsSerializer<W: Write> {
postings_write: CountingWriter<W>,