U
U
un1t2017-04-04 18:14:16
PostgreSQL
un1t, 2017-04-04 18:14:16

How to rank exact occurrences higher in PostgreSQL?

For example, there are entries, for example: "Stephen" and "Steve".
If you make such a request, then the records have the same weight and they can be in the output in any order.

SELECT * FROM offers WHERE to_tsvector('russian', name) @@ plainto_tsquery('russian', 'стивен');

The to_tsvector function truncates both words to "steve"
# select to_tsvector('russian', 'стивен');
-[ RECORD 1 ]---------
to_tsvector | 'стив':1

How can I make the exact occurrence of "steven" appear higher?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question