我的表有以下列:
我在努力创建一个杜松子酒索引。
方法一:显式铸造
CREATE INDEX pages_vector_ix ON pages USING GIN (to_tsvector(lang::regconfig, content_vector));这会创建以下错误,尽管使用了如描述的in this post那样的显式类型强制转换
function to_tsvector(regconfig, tsvector) does not exist方法二:更改列的类型
还应该可以将列类型更改为reconfig according to this post。
ALTER TABLE pages ALTER COLUMN lang TYPE reconfig USING lang::reconfig;现在我收到了一个错误,因为很明显,我已经将无法用作文本搜索配置的语言存储在数据库中,例如:
text search configuration "afrikaans" does not exist这个错误让我怀疑是否有可能在数据库中存储不受Postgres.支持的语言来设置GIN索引。
更多信息
select * from pg_catalog.pg_ts_config;结果:
cfgname | cfgnamespace | cfgowner | cfgparser
------------+--------------+----------+-----------
simple | 11 | 10 | 3722
danish | 11 | 10 | 3722
dutch | 11 | 10 | 3722
english | 11 | 10 | 3722
finnish | 11 | 10 | 3722
french | 11 | 10 | 3722
german | 11 | 10 | 3722
hungarian | 11 | 10 | 3722
italian | 11 | 10 | 3722
norwegian | 11 | 10 | 3722
portuguese | 11 | 10 | 3722
romanian | 11 | 10 | 3722
russian | 11 | 10 | 3722
spanish | 11 | 10 | 3722
swedish | 11 | 10 | 3722
turkish | 11 | 10 | 3722发布于 2022-07-03 11:46:49
由于content_vector已经是一个the向量,所以只需在其上构建索引即可。to_tsvector并不像它的第二个论点那样使用to向量,这样做没有意义。
https://stackoverflow.com/questions/72846084
复制相似问题