-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0004_sections_extras.up.sql
More file actions
22 lines (20 loc) · 935 Bytes
/
Copy path0004_sections_extras.up.sql
File metadata and controls
22 lines (20 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- 0004_sections_extras.up.sql — page citations + HyDE candidate questions.
--
-- Two retrieval-quality extensions to the sections table:
--
-- page_start / page_end
-- The inclusive page range each section covers, for parsers that
-- produce page-aware output (PDF today; others leave them NULL/0).
-- Surfaced to API responses so callers can render citations.
--
-- candidate_questions
-- JSONB array of generated questions a section can answer (HyDE).
-- Filled by the ingest pipeline's HyDE stage and woven into the
-- retrieval prompt to widen lexical/semantic overlap with the user
-- query.
ALTER TABLE sections
ADD COLUMN IF NOT EXISTS page_start INTEGER,
ADD COLUMN IF NOT EXISTS page_end INTEGER,
ADD COLUMN IF NOT EXISTS candidate_questions JSONB;
CREATE INDEX IF NOT EXISTS sections_doc_pages_idx
ON sections (document_id, page_start, page_end);