From d7da57a605770940bf6afb701000cfef171cac8f Mon Sep 17 00:00:00 2001 From: Paul Masurel Date: Fri, 22 Jan 2016 18:09:55 +0900 Subject: [PATCH] samllish stuff --- src/core/reader.rs | 1 - src/core/serial.rs | 7 +------ tests/core.rs | 6 ++---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/core/reader.rs b/src/core/reader.rs index ade062716..1d637c6e5 100644 --- a/src/core/reader.rs +++ b/src/core/reader.rs @@ -14,7 +14,6 @@ use core::directory::SegmentComponent; use fst::raw::MmapReadOnly; use core::error::{Result, Error}; - // TODO file structure should be in codec pub struct SegmentIndexReader { diff --git a/src/core/serial.rs b/src/core/serial.rs index a6349156e..356a4ec0d 100644 --- a/src/core/serial.rs +++ b/src/core/serial.rs @@ -15,9 +15,6 @@ pub trait SerializableSegment { } -// change the API to remove the lifetime, by -// "pushing" the data to a SegmentSerializer. - pub struct DebugSegmentSerializer { text: String, } @@ -42,6 +39,7 @@ impl DebugSegmentSerializer { } } + impl SegmentSerializer for DebugSegmentSerializer { fn new_term(&mut self, term: &Term, doc_freq: DocId) -> Result<()> { self.text.push_str(&format!("{:?}\n", term)); @@ -63,6 +61,3 @@ pub fn serialize_eq(left: &L, ri let str_right = DebugSegmentSerializer::debug_string(right); str_left == str_right } - - -// TODO make iteration over Fields somehow sorted diff --git a/tests/core.rs b/tests/core.rs index cb85c366e..62b0f40c7 100644 --- a/tests/core.rs +++ b/tests/core.rs @@ -55,11 +55,9 @@ fn test_indexing() { doc.set(Field(1), "a b c d"); index_writer.add(doc); } - let mut debug_serializer = DebugSegmentSerializer::new(); + let debug_serializer = DebugSegmentSerializer::new(); let segment_str_before_writing = DebugSegmentSerializer::debug_string(index_writer.current_segment_writer()); - - let commit_result = index_writer.commit(); - assert!(commit_result.is_ok()); + assert!(index_writer.commit().is_ok()); let segment = commit_result.unwrap(); let index_reader = SegmentIndexReader::open(segment).unwrap(); let segment_str_after_reading = DebugSegmentSerializer::debug_string(&index_reader);