pub struct RawNode {
pub title: String,
pub content: String,
pub level: usize,
pub line_start: usize,
pub line_end: usize,
pub page: Option<usize>,
pub token_count: Option<usize>,
pub total_token_count: Option<usize>,
}Expand description
A raw node extracted from a document.
This represents a section or element before it’s organized into a tree. Raw nodes are produced by parsers and consumed by the indexer.
Fields§
§title: StringTitle or heading of this node.
content: StringText content of this node (including all children’s content).
level: usizeLevel in the hierarchy (0 = root, 1 = top-level section, etc.).
line_start: usizeLine number where this node starts (1-based).
line_end: usizeLine number where this node ends (1-based).
page: Option<usize>Page number for PDF documents (1-based).
token_count: Option<usize>Estimated token count for this node’s own content.
total_token_count: Option<usize>Total token count including all children (recursive, computed by thinner).
Implementations§
Source§impl RawNode
impl RawNode
Sourcepub fn with_content(self, content: impl Into<String>) -> Self
pub fn with_content(self, content: impl Into<String>) -> Self
Set the content of this node.
Sourcepub fn with_level(self, level: usize) -> Self
pub fn with_level(self, level: usize) -> Self
Set the level of this node.
Sourcepub fn with_lines(self, start: usize, end: usize) -> Self
pub fn with_lines(self, start: usize, end: usize) -> Self
Set the line range of this node.
Sourcepub fn has_content(&self) -> bool
pub fn has_content(&self) -> bool
Check if this node has any content.
Sourcepub fn char_count(&self) -> usize
pub fn char_count(&self) -> usize
Get the character count of the content.
Sourcepub fn word_count(&self) -> usize
pub fn word_count(&self) -> usize
Get the word count (approximate) of the content.