Can someone explain to me how this:
SELECT description, description_search
FROM my_table
WHERE description_search @@ to_tsquery('ins:*')
can return this:
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
when no words in the returned string matches 'ins:*'?
Look at what to_tsquery returns.
select to_tsquery('ins:*');
to_tsquery
------------
'in':*
(1 row)
So 'ins:' gets stemmed to 'in:' (for English anyway), and 'in:*' obviously matches 'initi'
Don't use to_tsquery() if you have already written the query yourself. Just use the query your wrote, 'ins:*'::tsquery