I have column col
with data type CHARACTER VARYING
I need that index this column as gin
index. If trying directly set gin index to column, returned error:
data type character varying has no default operator class for access method "gin"
HINT: You must specify an operator class for the index or define a default operator class for the data type
If trying:
create index col_vector
on mytable
using gin (to_tsvector(col))
I got error: functions in index expression must be marked IMMUTABLE
How to create gin
index for CHARACTER VARYING
column ?
p.s. I need this for full text search
To create a full text index choose your table and right click on that table and select “Define Full-Text Index” option. Now select Unique Index. It is compulsory that for “Full Text Index” table must have at least one unique index. Select columns name and language types for columns.
The information in full-text indexes is used by the Full-Text Engine to compile full-text queries that can quickly search a table for particular words or combinations of words. A full-text index stores information about significant words and their location within one or more columns of a database table.
To implement a full-text search in a SQL database, you must create a full-text index on each column you want to be indexed. In MySQL, this would be done with the FULLTEXT keyword. Then you will be able to query the database using MATCH and AGAINST.
Try This Code:
CREATE INDEX "name " ON "tablename" USING gin(to_tsvector('english', "columnname"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With