2

我是 PostgreSQL 全文搜索的新手,发现了字典和停用词之类的东西。

我有一张桌子,上面有很多文本中的很多单词。我想创建自己的字典并将前 30 个最常用的单词作为停用词。

是否可以在运行时执行此操作?

4

1 回答 1

1

Anything is possible. Not everything is feasible.

What you can do without too much difficulty is create a stored procedure in a language like pl/perlU which breaks up the words, analyzes them, and writes stop words to a file. You'd have to do a pg_ctl reload in order to ensure that the new stop words file was used. However I don't think you can dynamically determine stop words at search time because if you search through the strings to look for stop words, there isn't much point in then having full text searching.

The actual stop words file is just a new-line separated list of words. Also I think you'd need to start with a template for stemming purposes. Trying to dynamically discover stemming would be both difficult and error-prone.

于 2013-03-22T06:41:22.267 回答