B
B
bora_bora2015-06-28 23:04:19
PostgreSQL
bora_bora, 2015-06-28 23:04:19

How to work with trigrams in PostgreSQL?

When working with trigrams, a request in Latin is processed perfectly, but for some reason it turns out to be "krakoyazbra" with Cyrillic. How to work with trigrams correctly so that the returned values ​​are similar to Latin (in the example) when you have Cyrillic?
Database in UTF-8.
Latin example:

select show_trgm('Naberezhnye Chelny');
                                         show_trgm                                         
-------------------------------------------------------------------------------------------
 {"  c","  n"," ch"," na",abe,ber,che,eln,ere,ezh,hel,hny,lny,nab,"ny ",nye,rez,"ye ",zhn}
(1 row)

Cyrillic example:
select show_trgm('Набережные Челны');
                                          show_trgm                                                
-----------------------------------------------------------------------------------------------------------------------------
---------------------
 {0x80d117,0x80df55,0x86b2c8,0x8f7d47,0x986ebe,0xa2d61a,0xa2226a,0xadf03c,0xceb992,0xe18a23,0x025732,0x13b218,5mm,0x3c6e80,0x
6351ac,udl,0x764fb5}
(1 row)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2015-06-28
@sim3x

Hmm
habrahabr.ru/post/78566/#comment_2294097
you need to smoke here www.sai.msu.su/~megera/postgres/talks/fts_pgsql_in...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question