I've added GIN index to my db
ALTER TABLE mtn_order
ADD COLUMN textsearchable_index_col tsvector
GENERATED ALWAYS AS (to_tsvector('english', coalesce(descr, '') || ' ' || coalesce(descrrep, ''))) STORED;
CREATE INDEX textsearch_idx ON mtn_order USING GIN (textsearchable_index_col);
and textsearchable_index_col = SearchVectorField(null=True)
to my model and now when i'm trying to save new instance i get:
ProgrammingError at /order/create/
cannot insert into column "textsearchable_index_col"
DETAIL: Column "textsearchable_index_col" is a generated column.
How to stop Django trying to write None
to that field