File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -100,11 +100,15 @@ Tsearch2 Integration
100
100
The first step is to generate an auxiliary table containing all
101
101
the unique words in the Tsearch2 index:
102
102
103
- CREATE TABLE words AS
104
- SELECT word FROM stat('SELECT vector FROM documents');
105
-
106
- Where 'documents' is the table that contains the Tsearch2 index
107
- column 'vector', of type 'tsvector'.
103
+ CREATE TABLE words AS SELECT word FROM
104
+ stat('SELECT to_tsvector(''simple'', bodytext) FROM documents');
105
+
106
+ Where 'documents' is a table that has a text field 'bodytext'
107
+ that TSearch2 is used to search. The use of the 'simple' dictionary
108
+ with the to_tsvector function, instead of just using the already
109
+ existing vector is to avoid creating a list of already stemmed
110
+ words. This way, only the original, unstemmed words are added
111
+ to the word list.
108
112
109
113
Next, create a trigram index on the word column:
110
114
You can’t perform that action at this time.
0 commit comments