Remove full description from search index

This commit is contained in:
rubenwardy 2022-09-14 22:12:43 +01:00
parent 7bfb183578
commit 90710cc8b9
2 changed files with 33 additions and 1 deletions

@ -385,7 +385,7 @@ class Package(db.Model):
name_valid = db.CheckConstraint("name ~* '^[a-z0-9_]+$' AND name != '_game'") name_valid = db.CheckConstraint("name ~* '^[a-z0-9_]+$' AND name != '_game'")
search_vector = db.Column(TSVectorType("name", "title", "short_desc", "desc", search_vector = db.Column(TSVectorType("name", "title", "short_desc", "desc",
weights={ "name": "A", "title": "B", "short_desc": "C", "desc": "D" })) weights={ "name": "A", "title": "B", "short_desc": "C" }))
license_id = db.Column(db.Integer, db.ForeignKey("license.id"), nullable=False, default=1) license_id = db.Column(db.Integer, db.ForeignKey("license.id"), nullable=False, default=1)
license = db.relationship("License", foreign_keys=[license_id]) license = db.relationship("License", foreign_keys=[license_id])

@ -0,0 +1,32 @@
"""empty message
Revision ID: 16eb610b7751
Revises: 76ff303f76d8
Create Date: 2022-09-14 21:10:40.126876
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
from sqlalchemy_searchable import sync_trigger
revision = '16eb610b7751'
down_revision = '76ff303f76d8'
branch_labels = None
depends_on = None
def upgrade():
conn = op.get_bind()
options = {"weights": {"name": "A", "title": "B", "short_desc": "C"}}
sync_trigger(conn, 'package', 'search_vector', ["name", "title", "short_desc"], options=options)
def downgrade():
conn = op.get_bind()
options = {"weights": {"name": "A", "title": "B", "short_desc": "C", "desc": "D"}}
sync_trigger(conn, 'package', 'search_vector', ["name", "title", "short_desc", "desc"], options=options)