如何让Postgresql反映对文本搜索配置所做的更改?
我正在尝试构建一个Postgresql文本搜索配置,将ISO日期(如“2015-02-19”)视为单个标记。所有默认配置都包括int和uint解析器,这将把日期分解为几个子关键字如何让Postgresql反映对文本搜索配置所做的更改?,postgresql,full-text-search,Postgresql,Full Text Search,我正在尝试构建一个Postgresql文本搜索配置,将ISO日期(如“2015-02-19”)视为单个标记。所有默认配置都包括int和uint解析器,这将把日期分解为几个子关键字 development=# SELECT * FROM ts_debug('english', '2371-05-01'); alias | description | token | dictionaries | dictionary | lexemes -------+-----------------
development=# SELECT * FROM ts_debug('english', '2371-05-01');
alias | description | token | dictionaries | dictionary | lexemes
-------+------------------+-------+--------------+------------+---------
uint | Unsigned integer | 2371 | {simple} | simple | {2371}
int | Signed integer | -05 | {simple} | simple | {-05}
int | Signed integer | -01 | {simple} | simple | {-01}
使用Postgres和,我做了一个配置,看起来应该可以工作:
development=# \dF+ iso_dates
Text search configuration "public.iso_dates"
Parser: "pg_catalog.default"
Token | Dictionaries
----------+--------------
numhword | simple
numword | simple
但是,当我尝试使用配置时,它仍然解析int和uint标记
development=# SELECT * FROM ts_debug('public.iso_dates', '2371-05-01');
alias | description | token | dictionaries | dictionary | lexemes
-------+------------------+-------+--------------+------------+---------
uint | Unsigned integer | 2371 | {} | |
int | Signed integer | -05 | {} | |
int | Signed integer | -01 | {} | |
发生什么事了?博士后在接受我的更改之前是否需要其他命令?我已经重新启动了数据库服务器,但不知道还有什么可以尝试。在您的情况下,您可以看到您的查询想要使用未签名和int配置,但是您的自定义配置
iso_dates
仅为numword
和numword
设置。下面的内容可能会让你找到你想要的东西
ALTER TEXT SEARCH CONFIGURATION english
ALTER MAPPING FOR numword, numhword, int, uint WITH iso_dates;