feat(search): pg_trgm-Suchindex + Backend-Endpunkt statt Client-Filter
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
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""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")
|
||||
Reference in New Issue
Block a user