mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-05-19 17:50:42 +00:00
Store throws an io::Error
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use Result;
|
||||
use DocId;
|
||||
use std::io;
|
||||
use schema::Schema;
|
||||
use schema::Document;
|
||||
use schema::Term;
|
||||
@@ -99,7 +100,7 @@ impl SegmentWriter {
|
||||
self.segment_serializer)
|
||||
}
|
||||
|
||||
pub fn add_document(&mut self, doc: &Document, schema: &Schema) -> Result<()> {
|
||||
pub fn add_document(&mut self, doc: &Document, schema: &Schema) -> io::Result<()> {
|
||||
let doc_id = self.max_doc;
|
||||
for (field, field_values) in doc.get_sorted_fields() {
|
||||
// TODO pos collision if the field is redundant
|
||||
|
||||
@@ -83,9 +83,7 @@ impl StoreWriter {
|
||||
fn write_and_compress_block(&mut self,) -> io::Result<()> {
|
||||
self.intermediary_buffer.clear();
|
||||
{
|
||||
let mut encoder = lz4::EncoderBuilder::new()
|
||||
.build(&mut self.intermediary_buffer)
|
||||
.unwrap();
|
||||
let mut encoder = try!(lz4::EncoderBuilder::new().build(&mut self.intermediary_buffer));
|
||||
try!(encoder.write_all(&self.current_block));
|
||||
let (_, encoder_result) = encoder.finish();
|
||||
try!(encoder_result);
|
||||
|
||||
Reference in New Issue
Block a user