Rah*_*986 6 postgresql full-text-search stop-words
我想从我的数据中删除停用词,但我不想阻止这些词,因为确切的词对我很重要.我用过这个查询.
SELECT to_tsvector('english',colName)from tblName order by lower asc;
Run Code Online (Sandbox Code Playgroud)
有没有什么方法可以删除stopWords而不会阻止词语?
谢谢
创建自己的文本搜索词典和配置:
CREATE TEXT SEARCH DICTIONARY simple_english
(TEMPLATE = pg_catalog.simple, STOPWORDS = english);
CREATE TEXT SEARCH CONFIGURATION simple_english
(copy = english);
ALTER TEXT SEARCH CONFIGURATION simple_english
ALTER MAPPING FOR asciihword, asciiword, hword, hword_asciipart, hword_part, word
WITH simple_english;
Run Code Online (Sandbox Code Playgroud)
它的工作原理如下:
SELECT to_tsvector('simple_english', 'many an ox eats the houses');
???????????????????????????????????????
? to_tsvector ?
???????????????????????????????????????
? 'eats':4 'houses':5 'many':1 'ox':3 ?
???????????????????????????????????????
(1 row)
Run Code Online (Sandbox Code Playgroud)
您可以将参数default_text_search_config设置simple_english为使其成为默认文本搜索配置.
| 归档时间: |
|
| 查看次数: |
2048 次 |
| 最近记录: |