0
特定の全文検索では、標準ストップワードファイルを修正していくつかの単語を除外する必要があります。私はこれまで何をしたか:Postgresqlはカスタムストップワードリストで検索設定を作成します
german_modified.stop
にgerman.stop
をコピーし、その後 がgerman_modified.stop
から単語を削除しました。その後:
CREATE TEXT SEARCH DICTIONARY public.german_nostop (
TEMPLATE = pg_catalog.simple,
STOPWORDS = german_modified
);
CREATE TEXT SEARCH CONFIGURATION public.german_nostop (
COPY = pg_catalog.german
);
ALTER TEXT SEARCH CONFIGURATION public.german_nostop
ALTER MAPPING
FOR asciiword, asciihword, hword_asciipart, hword, hword_part, word
WITH german_nostop;
CREATE INDEX body_idx ON comments
USING gin (to_tsvector('german_nostop', body));
しかし、私は
SELECT body, autor
FROM comments
WHERE to_tsvector('german_nostop', body) @@ to_tsquery('wie');
を行うときに私が取得:
NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored
NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored
NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored
body | autor
------+-------
(0 rows)
'wie'
は私が修正ストップワードリストから削除言葉です。何らかの理由で、PostgreSQLは新しいストップリストを使用しませんでした。他の検索のためにオリジナルを使用したいので、私は実際にオリジナルを変更したくありません。
ありがとうございました!何らかの理由でインデックスを再作成する必要がありましたが、現在は期待どおりに動作しています。 – Alex