Align search migrations and test schemas
This commit is contained in:
parent
142b0a5809
commit
9da416dbe4
|
|
@ -1,7 +1,7 @@
|
|||
-- Slice 1 + Slice 2 generic search support for DOC documents.
|
||||
-- Adds lexical-search support columns/indexes and pg_trgm extension.
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm with schema doc;
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm with schema public;
|
||||
|
||||
ALTER TABLE DOC.doc_text_representation
|
||||
ADD COLUMN IF NOT EXISTS search_config VARCHAR(64);
|
||||
|
|
@ -15,12 +15,12 @@ CREATE INDEX IF NOT EXISTS idx_doc_text_repr_search_vector
|
|||
|
||||
CREATE INDEX IF NOT EXISTS idx_doc_document_title_trgm
|
||||
ON DOC.doc_document
|
||||
USING GIN (title DOC.gin_trgm_ops);
|
||||
USING GIN (title public.gin_trgm_ops);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_doc_document_summary_trgm
|
||||
ON DOC.doc_document
|
||||
USING GIN (summary DOC.gin_trgm_ops);
|
||||
USING GIN (summary public.gin_trgm_ops);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_doc_text_repr_text_trgm
|
||||
ON DOC.doc_text_representation
|
||||
USING GIN (text_body DOC.gin_trgm_ops);
|
||||
USING GIN (text_body public.gin_trgm_ops);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ ALTER TABLE DOC.doc_embedding
|
|||
ADD CONSTRAINT ck_doc_embedding_dimensions_positive
|
||||
CHECK (embedding_dimensions IS NULL OR embedding_dimensions > 0);
|
||||
|
||||
ALTER TABLE DOC.doc_embedding
|
||||
ADD COLUMN IF NOT EXISTS embedding_vector public.vector;
|
||||
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
-- This makes migration, audit, and repair flows package-aware without having to derive the
|
||||
-- package membership from source paths at query time.
|
||||
|
||||
SET search_path TO TED, DOC, public;
|
||||
SET search_path TO ted, doc, public;
|
||||
|
||||
ALTER TABLE IF EXISTS TED.ted_notice_projection
|
||||
ADD COLUMN IF NOT EXISTS package_identifier VARCHAR(20);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
-- Slice 1 generic lexical search support.
|
||||
-- Adds PostgreSQL full-text and trigram search infrastructure for DOC-side search.
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm with schema doc;
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm with schema public;
|
||||
|
||||
ALTER TABLE doc.doc_text_representation
|
||||
ADD COLUMN IF NOT EXISTS search_config VARCHAR(64);
|
||||
|
|
@ -15,12 +15,12 @@ CREATE INDEX IF NOT EXISTS idx_doc_text_repr_search_vector
|
|||
|
||||
CREATE INDEX IF NOT EXISTS idx_doc_document_title_trgm
|
||||
ON doc.doc_document
|
||||
USING GIN (title doc.gin_trgm_ops);
|
||||
USING GIN (title public.gin_trgm_ops);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_doc_document_summary_trgm
|
||||
ON doc.doc_document
|
||||
USING GIN (summary doc.gin_trgm_ops);
|
||||
USING GIN (summary public.gin_trgm_ops);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_doc_text_repr_text_trgm
|
||||
ON doc.doc_text_representation
|
||||
USING GIN (text_body doc.gin_trgm_ops);
|
||||
USING GIN (text_body public.gin_trgm_ops);
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ CREATE INDEX idx_doc_procedure_type ON procurement_document(procedure_type);
|
|||
CREATE INDEX idx_doc_cpv_codes ON procurement_document USING GIN(cpv_codes);
|
||||
|
||||
-- Full-text search on textual content
|
||||
CREATE INDEX idx_doc_text_content_trgm ON procurement_document USING GIN(text_content gin_trgm_ops);
|
||||
CREATE INDEX idx_doc_text_content_trgm ON procurement_document USING GIN(text_content public.gin_trgm_ops);
|
||||
|
||||
-- Vector similarity search using IVFFlat index (efficient for approximate nearest neighbor)
|
||||
-- Lists parameter: sqrt(number_of_vectors) for optimal performance
|
||||
|
|
|
|||
|
|
@ -87,13 +87,13 @@ public abstract class AbstractSearchIntegrationTest {
|
|||
|
||||
protected void ensureSearchColumnsAndIndexes() {
|
||||
jdbcTemplate.execute("CREATE SCHEMA IF NOT EXISTS doc");
|
||||
jdbcTemplate.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm with schema doc");
|
||||
jdbcTemplate.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm with schema public");
|
||||
jdbcTemplate.execute("ALTER TABLE doc.doc_text_representation ADD COLUMN IF NOT EXISTS search_config VARCHAR(64)");
|
||||
jdbcTemplate.execute("ALTER TABLE doc.doc_text_representation ADD COLUMN IF NOT EXISTS search_vector tsvector");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_text_repr_search_vector_test ON doc.doc_text_representation USING GIN (search_vector)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_document_title_trgm_test ON doc.doc_document USING GIN (title doc.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_document_summary_trgm_test ON doc.doc_document USING GIN (summary doc.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_text_repr_text_trgm_test ON doc.doc_text_representation USING GIN (text_body doc.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_document_title_trgm_test ON doc.doc_document USING GIN (title public.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_document_summary_trgm_test ON doc.doc_document USING GIN (summary public.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_text_repr_text_trgm_test ON doc.doc_text_representation USING GIN (text_body public.gin_trgm_ops)");
|
||||
}
|
||||
|
||||
protected void cleanupDatabase() {
|
||||
|
|
|
|||
|
|
@ -121,14 +121,14 @@ public abstract class AbstractSemanticSearchIntegrationTest {
|
|||
}
|
||||
|
||||
protected void ensureSearchColumnsAndIndexes() {
|
||||
jdbcTemplate.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA doc");
|
||||
jdbcTemplate.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public");
|
||||
jdbcTemplate.execute("CREATE EXTENSION IF NOT EXISTS vector WITH SCHEMA public");
|
||||
jdbcTemplate.execute("ALTER TABLE doc.doc_text_representation ADD COLUMN IF NOT EXISTS search_config VARCHAR(64)");
|
||||
jdbcTemplate.execute("ALTER TABLE doc.doc_text_representation ADD COLUMN IF NOT EXISTS search_vector tsvector");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_text_repr_search_vector_test ON doc.doc_text_representation USING GIN (search_vector)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_document_title_trgm_test ON doc.doc_document USING GIN (title doc.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_document_summary_trgm_test ON doc.doc_document USING GIN (summary doc.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_text_repr_text_trgm_test ON doc.doc_text_representation USING GIN (text_body doc.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_document_title_trgm_test ON doc.doc_document USING GIN (title public.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_document_summary_trgm_test ON doc.doc_document USING GIN (summary public.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_text_repr_text_trgm_test ON doc.doc_text_representation USING GIN (text_body public.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("ALTER TABLE doc.doc_embedding ADD COLUMN IF NOT EXISTS embedding_vector public.vector");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,13 +82,13 @@ public abstract class AbstractTedStructuredSearchIntegrationTest {
|
|||
protected void ensureSearchColumnsAndIndexes() {
|
||||
jdbcTemplate.execute("CREATE SCHEMA IF NOT EXISTS doc");
|
||||
jdbcTemplate.execute("CREATE SCHEMA IF NOT EXISTS ted");
|
||||
jdbcTemplate.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm with schema doc");
|
||||
jdbcTemplate.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm with schema public");
|
||||
jdbcTemplate.execute("ALTER TABLE doc.doc_text_representation ADD COLUMN IF NOT EXISTS search_config VARCHAR(64)");
|
||||
jdbcTemplate.execute("ALTER TABLE doc.doc_text_representation ADD COLUMN IF NOT EXISTS search_vector tsvector");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_text_repr_search_vector_test ON doc.doc_text_representation USING GIN (search_vector)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_document_title_trgm_test ON doc.doc_document USING GIN (title doc.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_document_summary_trgm_test ON doc.doc_document USING GIN (summary doc.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_text_repr_text_trgm_test ON doc.doc_text_representation USING GIN (text_body doc.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_document_title_trgm_test ON doc.doc_document USING GIN (title public.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_document_summary_trgm_test ON doc.doc_document USING GIN (summary public.gin_trgm_ops)");
|
||||
jdbcTemplate.execute("CREATE INDEX IF NOT EXISTS idx_doc_text_repr_text_trgm_test ON doc.doc_text_representation USING GIN (text_body public.gin_trgm_ops)");
|
||||
}
|
||||
|
||||
protected void cleanupDatabase() {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
CREATE SCHEMA IF NOT EXISTS DOC;
|
||||
CREATE SCHEMA IF NOT EXISTS TED;
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm with schema doc;
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm with schema public;
|
||||
|
|
|
|||
Loading…
Reference in New Issue