Expand description
Document indexing module.
This module provides functionality to build and maintain document indices:
- Tree Building — Convert raw nodes to hierarchical trees
- Thinning — Merge small nodes with parents
- Merging — Combine adjacent small nodes
- Incremental — Update indices when documents change
§Example
use vectorless::indexer::TreeBuilder;
use vectorless::document::RawNode;
let raw_nodes = vec![
RawNode { level: 1, title: "Section 1".into(), ..Default::default() },
RawNode { level: 2, title: "Subsection".into(), ..Default::default() },
];
let tree = TreeBuilder::new()
.with_root_title("My Document")
.build(raw_nodes);Re-exports§
pub use crate::config::IndexerConfig;
Structs§
- Diff
Result - Diff result between old and new document structure.
- Incremental
Indexer - Incremental indexer for updating existing indices.
- Thinning
Config - Configuration for tree thinning.
- Thinning
Config Builder - Builder for ThinningConfig.
- Tree
Builder - Builder for constructing document trees from raw nodes.
Functions§
- calculate_
total_ tokens - Calculate total token counts for all nodes (recursive, includes children).
- diff_
trees - Compare two document trees and find differences.
- merge_
adjacent_ small_ nodes - Merge adjacent sibling nodes that are below token threshold.
- merge_
children_ into_ parent - Merge all small children into parent.
- subtree_
token_ count - Calculate total token count for a subtree.
- thin_
raw_ nodes - Apply thinning to raw nodes before tree construction.
- thin_
tree - Thin a document tree by merging small nodes.