2013-05-13 11 views
5

Mam kolumnę col z typ danych CHARACTER VARYINGindeksowania kolumna dla przeszukiwanie pełnego tekstu

muszę tego indeksu tej kolumnie jako gin indeksu. Jakby próbując ustawić indeks gin bezpośrednio do kolumny, zwrócił błąd:

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

jeśli próbuje:

create index col_vector 
on mytable 
using gin (to_tsvector(col)) 

mam błąd: functions in index expression must be marked IMMUTABLE

Jak stworzyć gin indeks CHARACTER VARYING kolumnie?

p.s. Muszę to dla przeszukiwanie pełnego tekstu

+0

Jest to omówione w podręczniku na wyszukiwanie pełnotekstowe. –

Odpowiedz

8

Spróbuj ten kod:

CREATE INDEX "name " ON "tablename" USING gin(to_tsvector('english', "columnname")); 
+0

Oto wyjaśnienie: http://www.postgresql.org/docs/9.3/static/textsearch-tables.html –

Powiązane problemy