SELECT id
FROM pst
WHERE to_tsvector("title") @@ plainto_tsquery('наконец')
ORDER BY ts_rank(to_tsvector("title"), plainto_tsquery('наконец')) DESC;
SELECT to_tsvector("title")
FROM pst
WHERE pst.id = 28;
-----
'дел':3 'кот':1 'сдела':2
-----
SELECT to_tsvector("title")
FROM pst post
WHERE post.id = 29;
-----
'дел':1 'кот':3 'сдела':2
melkij=> SELECT * from ts_debug('russian', 'дело сделать кот наконец то');
alias | description | token | dictionaries | dictionary | lexemes
-------+-------------------+---------+----------------+--------------+---------
word | Word, all letters | дело | {russian_stem} | russian_stem | {дел}
blank | Space symbols | | {} | |
word | Word, all letters | сделать | {russian_stem} | russian_stem | {сдела}
blank | Space symbols | | {} | |
word | Word, all letters | кот | {russian_stem} | russian_stem | {кот}
blank | Space symbols | | {} | |
word | Word, all letters | наконец | {russian_stem} | russian_stem | {}
blank | Space symbols | | {} | |
word | Word, all letters | то | {russian_stem} | russian_stem | {}
(9 строк)
lexemes text[] — the lexeme(s) produced by the dictionary that recognized the token, or NULL if none did; an empty array ({}) means it was recognized as a stop word
melkij=> SELECT ts_lexize('russian_stem', 'наконец');
ts_lexize
-----------
{}
ts_lexize returns an array of lexemes if the input token is known to the dictionary, or an empty array if the token is known to the dictionary but it is a stop word, or NULL if it is an unknown word.