pub struct IndexContext {Show 15 fields
pub doc_id: String,
pub input: IndexInput,
pub format: DocumentFormat,
pub name: String,
pub source_path: Option<PathBuf>,
pub raw_nodes: Vec<RawNode>,
pub tree: Option<DocumentTree>,
pub options: PipelineOptions,
pub llm_client: Option<LlmClient>,
pub summary_cache: SummaryCache,
pub stage_results: HashMap<String, StageResult>,
pub metrics: IndexMetrics,
pub description: Option<String>,
pub page_count: Option<usize>,
pub line_count: Option<usize>,
}Expand description
Index context passed between stages.
Fields§
§doc_id: StringDocument ID.
input: IndexInputSource input.
format: DocumentFormatDocument format.
name: StringDocument name.
source_path: Option<PathBuf>Source file path (if from file).
raw_nodes: Vec<RawNode>Parsed raw nodes.
tree: Option<DocumentTree>Built document tree.
options: PipelineOptionsIndex options.
llm_client: Option<LlmClient>LLM client for enhancement.
summary_cache: SummaryCacheSummary cache for lazy generation.
stage_results: HashMap<String, StageResult>Stage execution results.
metrics: IndexMetricsPerformance metrics.
description: Option<String>Document description.
page_count: Option<usize>Page count (for PDFs).
line_count: Option<usize>Line count.
Implementations§
Source§impl IndexContext
impl IndexContext
Sourcepub fn new(input: IndexInput, options: PipelineOptions) -> Self
pub fn new(input: IndexInput, options: PipelineOptions) -> Self
Create a new context from input.
Sourcepub fn with_doc_id(self, doc_id: impl Into<String>) -> Self
pub fn with_doc_id(self, doc_id: impl Into<String>) -> Self
Set the document ID.
Sourcepub fn with_llm_client(self, client: LlmClient) -> Self
pub fn with_llm_client(self, client: LlmClient) -> Self
Set the LLM client.
Sourcepub fn with_format(self, format: DocumentFormat) -> Self
pub fn with_format(self, format: DocumentFormat) -> Self
Set the document format.
Sourcepub fn with_source_path(self, path: impl Into<PathBuf>) -> Self
pub fn with_source_path(self, path: impl Into<PathBuf>) -> Self
Set the source path.
Sourcepub fn init_summary_cache(&mut self)
pub fn init_summary_cache(&mut self)
Initialize summary cache based on strategy.
Sourcepub fn record_stage(&mut self, name: &str, result: StageResult)
pub fn record_stage(&mut self, name: &str, result: StageResult)
Record a stage result.
Sourcepub fn tree(&self) -> Result<&DocumentTree, &'static str>
pub fn tree(&self) -> Result<&DocumentTree, &'static str>
Get the tree, returning an error if not built.
Sourcepub fn tree_mut(&mut self) -> Result<&mut DocumentTree, &'static str>
pub fn tree_mut(&mut self) -> Result<&mut DocumentTree, &'static str>
Get mutable tree, returning an error if not built.
Sourcepub fn finalize(self) -> IndexResult
pub fn finalize(self) -> IndexResult
Finalize and build the result.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IndexContext
impl !RefUnwindSafe for IndexContext
impl Send for IndexContext
impl Sync for IndexContext
impl Unpin for IndexContext
impl UnsafeUnpin for IndexContext
impl !UnwindSafe for IndexContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more