Simplify Index::fields_metadata to use TantivySegmentReader::open

This commit is contained in:
Pascal Seitz
2026-04-02 15:31:01 +08:00
parent 548eb6ebc7
commit 32aee13aad
2 changed files with 2 additions and 7 deletions

View File

@@ -466,13 +466,7 @@ impl Index {
let fields_metadata: Vec<Vec<FieldMetadata>> = segments
.into_iter()
.map(|segment| {
let reader = TantivySegmentReader::open_with_custom_alive_set_from_directory(
segment.index().directory(),
segment.meta(),
segment.schema(),
None,
)?;
let reader: Arc<dyn crate::index::SegmentReader> = Arc::new(reader);
let reader = TantivySegmentReader::open(&segment)?;
reader.fields_metadata()
})
.collect::<Result<_, _>>()?;

View File

@@ -287,6 +287,7 @@ pub struct IndexMeta {
#[serde(skip_serializing_if = "Option::is_none")]
pub payload: Option<String>,
}
#[derive(Deserialize, Debug)]
struct UntrackedIndexMeta {
pub segments: Vec<InnerSegmentMeta>,