mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2025-12-23 02:29:57 +00:00
samllish stuff
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user