Command Palette lud bisher beim Öffnen ALLE Objekte und filterte nur clientseitig per .includes() - unscharf und würde bei mehr Objekten langsam werden. Jetzt: GIN-Trigram-Index auf objekt.name/code (Migration 0023), neuer GET /suche?q=-Endpunkt (Ähnlichkeits-Ranking per pg_trgm similarity()), Frontend debounced (250ms) statt vollständiger Objektliste. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
27 lines
863 B
Python
27 lines
863 B
Python
"""SEARCH-001: pg_trgm-Erweiterung + GIN-Trigram-Index auf Objekt.name/code.
|
|
|
|
Revision ID: 0023_suchindex
|
|
Revises: 0022_wartung
|
|
Create Date: 2026-09-08
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
|
|
revision: str = "0023_suchindex"
|
|
down_revision: Union[str, None] = "0022_wartung"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm")
|
|
op.execute("CREATE INDEX ix_objekt_name_trgm ON objekt USING GIN (name gin_trgm_ops)")
|
|
op.execute("CREATE INDEX ix_objekt_code_trgm ON objekt USING GIN (code gin_trgm_ops)")
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.execute("DROP INDEX IF EXISTS ix_objekt_code_trgm")
|
|
op.execute("DROP INDEX IF EXISTS ix_objekt_name_trgm")
|
|
op.execute("DROP EXTENSION IF EXISTS pg_trgm")
|