S
S
Semyon Semyonov2018-09-17 02:32:27
PostgreSQL
Semyon Semyonov, 2018-09-17 02:32:27

How to use case sensitivity of Russian words in pg_search?

I am using gem pg_search. Everything is wonderful until you look for words in different registers of Russian words. Those. "apple" and "apple" are different results. But "test" and "Test" are the same. How to solve it?
So far, only one option comes to my mind, but it is stupid. We make another column in which all the content is in lower case. And when we search, the searched word is also translated into lower case. Then, of course, the result will be the desired one, but this is a stupid duplication. Well, if there is one column, but there can be many of them.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Telepnev, 2018-09-17
@TelepnevDmitriy

Look towards default_text_search_config in postgres configs (postgresql.conf). In your case, it should be pg_catalog.russian. Look at the query that the ORM generates. It may turn out that your configs have parted.
For example,

select to_tsvector('pg_catalog.english', 'яблоко'), to_tsquery('pg_catalog.russian', 'Яблоко')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question