@@ -33,6 +33,35 @@ type Config struct {
3333// IngestConfig configures retrieval-quality boosters that run during
3434// the ingest pipeline (between summarize and StatusReady).
3535type IngestConfig struct {
36+ // Mode selects how much work the ingest pipeline does before a
37+ // document is marked ready.
38+ //
39+ // "full" (default) — parse → build tree → persist → summarize
40+ // → HyDE → multi-axis summaries → TOC build.
41+ // Maximises retrieval quality at the cost of
42+ // ~1,000-3,000 LLM calls + a table-extraction
43+ // pass on a large filing (minutes of wall time).
44+ //
45+ // "minimal" — parse → build tree → persist → ready.
46+ // Skips ALL per-section LLM enrichment
47+ // (summarize, HyDE, multi-axis, TOC build)
48+ // AND the pdftable table-finding pass, so a
49+ // document becomes queryable in ~parse-speed
50+ // (seconds). The page-based retrieval strategy
51+ // (/v1/answer/pageindex) needs none of the
52+ // skipped enrichment: it navigates a TOC tree
53+ // (synthesised from the section tree when
54+ // documents.toc_tree is NULL) and reads raw
55+ // section/page text at query time — and the raw
56+ // page text still contains the tables' text, so
57+ // dropping table *sections* loses nothing for
58+ // it. The summary-dependent strategies
59+ // (chunked-tree, agentic) degrade to using
60+ // titles + raw content with no summaries.
61+ //
62+ // Empty defaults to "full". Engine env override: VLE_INGEST_MODE.
63+ Mode string `yaml:"mode"`
64+
3665 HyDE HyDEConfig `yaml:"hyde"`
3766
3867 // Tables configures pdftable's table-finding pass over PDF inputs.
@@ -695,6 +724,7 @@ func Default() Config {
695724 },
696725 },
697726 Ingest : IngestConfig {
727+ Mode : "full" ,
698728 GlobalLLMConcurrency : 12 ,
699729 LLMCallTimeoutSeconds : 90 ,
700730 MaxSections : 400 ,
@@ -838,6 +868,11 @@ func applyEnvOverrides(c *Config) {
838868 if v := os .Getenv ("VLE_RETRIEVAL_AGENTIC_MODEL" ); v != "" {
839869 c .Retrieval .Agentic .Model = v
840870 }
871+ // Ingest mode switch (full | minimal). A single env var flips the
872+ // engine into fast/minimal ingest with no secret edit.
873+ if v := os .Getenv ("VLE_INGEST_MODE" ); v != "" {
874+ c .Ingest .Mode = v
875+ }
841876 // Ingest / HyDE knobs. Booleans accept the usual truthy strings —
842877 // kept narrow so a typo doesn't silently flip the flag.
843878 if v := os .Getenv ("VLE_INGEST_HYDE_ENABLED" ); v != "" {
@@ -1144,6 +1179,12 @@ func (c Config) Validate() error {
11441179 return fmt .Errorf ("server.tls.min_version must be 1.2 or 1.3, got %q" , v )
11451180 }
11461181
1182+ switch c .Ingest .Mode {
1183+ case "" , "full" , "minimal" :
1184+ default :
1185+ return fmt .Errorf ("ingest.mode must be one of full|minimal, got %q" , c .Ingest .Mode )
1186+ }
1187+
11471188 if c .Ingest .HyDE .NumQuestions < 0 {
11481189 return fmt .Errorf ("ingest.hyde.num_questions must be >= 0, got %d" , c .Ingest .HyDE .NumQuestions )
11491190 }
0 commit comments