That result makes sense to me. Ke
and Kerber
are different words so they don't match in full-text search.
Full-text search only does stemming - removing plurals, etc - so that cats
matches cat
. Even this isn't exactly smart - atypical plurals like dice
aren't handled. It also only works for words recognised in the target language dictionary, so even if Kerber
was the plural of Ke
it wouldn't be stemmed when the language is set to english
.
See the tsquery and tsvectors:
regress=> SELECT to_tsvector('Kerber'), to_tsquery('Kerber'), to_tsvector('ke'), to_tsquery('ke');
to_tsvector | to_tsquery | to_tsvector | to_tsquery
-------------+------------+-------------+------------
'kerber':1 | 'kerber' | 'ke':1 | 'ke'
(1 row)
and the matches:
regress=> SELECT to_tsvector('Kerber') @@ to_tsquery('Kerber'), to_tsvector('kerber') @@ to_tsquery('ke');
?column? | ?column?
----------+----------
t | f
(1 row)
I suspect that you want a tsearch prefix match. This is expressed with a :*
wildcard:
regress=> SELECT to_tsvector('kerber') @@ to_tsquery('ke:*');
?column?
----------
t
(1 row)
This only works for prefix matching. It can have an impact on search efficiency, but I don't think it's a major one.