mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
* docs: transient docs * chore: cleanup * webvtt WIP * webvtt field * chore: webvtt tests comments * chore: remove useless tests * feat: search TASK.md * feat: full text search by title/webvtt * chore: search api task * feat: search api * feat: search API * chore: rm task md * chore: roll back unnecessary validators * chore: pr review WIP * chore: pr review WIP * chore: pr review * chore: top imports * feat: better lint + ci * feat: better lint + ci * feat: better lint + ci * feat: better lint + ci * chore: lint * chore: lint * fix: db datetime definitions * fix: flush() params * fix: update transcript mutability expectation / test * fix: update transcript mutability expectation / test * chore: auto review * chore: new controller extraction * chore: new controller extraction * chore: cleanup * chore: review WIP * chore: pr WIP * chore: remove ci lint * chore: openapi regeneration * chore: openapi regeneration * chore: postgres test doc * fix: .dockerignore for arm binaries * fix: .dockerignore for arm binaries * fix: cap test loops * fix: cap test loops * fix: cap test loops * fix: get_transcript_topics * chore: remove flow.md docs and claude guidance * chore: remove claude.md db doc * chore: remove claude.md db doc * chore: remove claude.md db doc * chore: remove claude.md db doc
48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
"""add_full_text_search
|
|
|
|
Revision ID: 116b2f287eab
|
|
Revises: 0bc0f3ff0111
|
|
Create Date: 2025-08-07 11:27:38.473517
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision: str = '116b2f287eab'
|
|
down_revision: Union[str, None] = '0bc0f3ff0111'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
conn = op.get_bind()
|
|
if conn.dialect.name != 'postgresql':
|
|
return
|
|
|
|
op.execute("""
|
|
ALTER TABLE transcript ADD COLUMN search_vector_en tsvector
|
|
GENERATED ALWAYS AS (
|
|
setweight(to_tsvector('english', coalesce(title, '')), 'A') ||
|
|
setweight(to_tsvector('english', coalesce(webvtt, '')), 'B')
|
|
) STORED
|
|
""")
|
|
|
|
op.create_index(
|
|
'idx_transcript_search_vector_en',
|
|
'transcript',
|
|
['search_vector_en'],
|
|
postgresql_using='gin'
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
conn = op.get_bind()
|
|
if conn.dialect.name != 'postgresql':
|
|
return
|
|
|
|
op.drop_index('idx_transcript_search_vector_en', table_name='transcript')
|
|
op.drop_column('transcript', 'search_vector_en')
|