mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-09-08 06:19:10 +00:00
Exposed API to create a new Segment.
This commit is contained in:
@@ -356,6 +356,11 @@ impl IndexWriter {
|
||||
result
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
pub fn new_segment(&self) -> Segment {
|
||||
self.segment_updater.new_segment()
|
||||
}
|
||||
|
||||
/// Spawns a new worker thread for indexing.
|
||||
/// The thread consumes documents from the pipeline.
|
||||
///
|
||||
@@ -429,6 +434,12 @@ impl IndexWriter {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn add_segment(&mut self, segment_meta: SegmentMeta) {
|
||||
let delete_cursor = self.delete_queue.cursor();
|
||||
let segment_entry = SegmentEntry::new(segment_meta, delete_cursor, None);
|
||||
self.segment_updater.add_segment(self.generation, segment_entry);
|
||||
}
|
||||
|
||||
/// Detects and removes the files that
|
||||
/// are not used by the index anymore.
|
||||
pub fn garbage_collect_files(&mut self) -> Result<()> {
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ pub mod fastfield;
|
||||
|
||||
|
||||
pub use directory::Directory;
|
||||
pub use core::{Index, Segment, SegmentId, SegmentMeta, Searcher};
|
||||
pub use core::{Index, Segment, SegmentComponent, SegmentId, SegmentMeta, Searcher};
|
||||
pub use indexer::IndexWriter;
|
||||
pub use schema::{Term, Document};
|
||||
pub use core::SegmentReader;
|
||||
|
||||
Reference in New Issue
Block a user