CREATE INDEX message_fulltext_idx ON feedback USING gin(to_tsvector(message));
ERROR: functions in index predicate must be marked IMMUTABLE
How to avoid this?
Full Text Search is used by search engines, shops, and many other websites all around the world. By default, searches on PostgreSQL database are exact.
GIN stands for Generalized Inverted Index. GIN is designed for handling cases where the items to be indexed are composite values, and the queries to be handled by the index need to search for element values that appear within the composite items.
Full-text indexes are created on text-based columns ( CHAR , VARCHAR , or TEXT columns) to speed up queries and DML operations on data contained within those columns. A full-text index is defined as part of a CREATE TABLE statement or added to an existing table using ALTER TABLE or CREATE INDEX .
Yes, You Can Keep Full-Text Search in Postgres You can get even deeper and make your Postgres full-text search even more robust, by implementing features such as highlighting results, or writing your own custom dictionaries or functions.
You need to include the optional config parameter. Without it, the function is not immutable. For example, if you want the standard English text parsing:
CREATE INDEX message_fulltext_idx ON feedback
USING gin(to_tsvector('english', message));
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