to_tsquery() return 一个值怎么会和搜索到的值不匹配呢?
How can to_tsquery() return a value that does not match the searched value?
谁能给我解释一下这是怎么回事:
SELECT description, description_search
FROM my_table
WHERE description_search @@ to_tsquery('ins:*')
可以return这个:
description:
'The leap second configuration has been updated.
Reason: Leap second data initialized from registry during boot
Leap seconds enabled: true
New leap second count: 0
Old leap second count: 0'
description_search:
'0':25,30 'boot':16 'configur':4 'count':24,29 'data':11 'enabl':19 'initi':12
'leap':2,9,17,22,27 'new':21 'old':26 'reason':8 'registri':14 'second':3,10,18,23,28
'true':20 'updat':7
当 returned 字符串中没有匹配的词时 'ins:*'?
看看什么to_tsquery returns.
select to_tsquery('ins:*');
to_tsquery
------------
'in':*
(1 row)
所以 'ins:' 被词干化为 'in:'(无论如何对于英语),并且 'in:*' 显然匹配 'initi'
如果您已经自己编写了查询,请不要使用 to_tsquery()。只需使用您编写的查询,'ins:*'::tsquery
谁能给我解释一下这是怎么回事:
SELECT description, description_search
FROM my_table
WHERE description_search @@ to_tsquery('ins:*')
可以return这个:
description:
'The leap second configuration has been updated.
Reason: Leap second data initialized from registry during boot
Leap seconds enabled: true
New leap second count: 0
Old leap second count: 0'
description_search:
'0':25,30 'boot':16 'configur':4 'count':24,29 'data':11 'enabl':19 'initi':12
'leap':2,9,17,22,27 'new':21 'old':26 'reason':8 'registri':14 'second':3,10,18,23,28
'true':20 'updat':7
当 returned 字符串中没有匹配的词时 'ins:*'?
看看什么to_tsquery returns.
select to_tsquery('ins:*');
to_tsquery
------------
'in':*
(1 row)
所以 'ins:' 被词干化为 'in:'(无论如何对于英语),并且 'in:*' 显然匹配 'initi'
如果您已经自己编写了查询,请不要使用 to_tsquery()。只需使用您编写的查询,'ins:*'::tsquery