Don't try and built search with Postgres
This commit is contained in:
parent
6a0e76440a
commit
0e37348e14
|
@ -5,9 +5,8 @@ import typing
|
|||
|
||||
import sqlalchemy
|
||||
import sqlalchemy.orm.decl_api
|
||||
from sqlalchemy import Index, func, text
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy.dialects import postgresql
|
||||
from sqlalchemy.dialects.postgresql import TSVECTOR
|
||||
from sqlalchemy.ext.associationproxy import association_proxy
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.ext.orderinglist import ordering_list
|
||||
|
@ -172,22 +171,6 @@ class Event(TimeStampedModel):
|
|||
event_type = Column(String)
|
||||
url = Column(String)
|
||||
cancelled = Column(Boolean)
|
||||
search_vector = Column(TSVECTOR)
|
||||
|
||||
trigger = text(
|
||||
"""
|
||||
CREATE TRIGGER event_vector_update BEFORE INSERT OR UPDATE
|
||||
ON event FOR EACH ROW EXECUTE FUNCTION
|
||||
tsvector_update_trigger(search_vector, 'pg_catalog.english', title, abstract, description);
|
||||
"""
|
||||
)
|
||||
|
||||
Index(
|
||||
"event_search_vector_idx",
|
||||
search_vector,
|
||||
postgresql_using="gin",
|
||||
postgresql_ops={"abstract_search_vector": "gin_trgm_ops"},
|
||||
)
|
||||
|
||||
conference = relationship("Conference", back_populates="events")
|
||||
|
||||
|
|
Loading…
Reference in a new issue