samllish stuff

This commit is contained in:
Paul Masurel
2016-01-22 18:09:55 +09:00
parent 1e61cefc99
commit d7da57a605
3 changed files with 3 additions and 11 deletions

View File

@@ -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 {

View File

@@ -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<String> 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<L: SerializableSegment, R: SerializableSegment>(left: &L, ri
let str_right = DebugSegmentSerializer::debug_string(right);
str_left == str_right
}
// TODO make iteration over Fields somehow sorted

View File

@@ -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);