Hello, I have been trying to understand how pg_trgm works. As part of that, I was looking at gin_extract_query_trgm(), which I think, extracts trigrams from a search query string. So, I debugged for 3 cases:
1) column_name LIKE '%緊急%' in this case, inside gin_extract_query_trgm(), after a call to generate_wildcard_trgm(), returned trglen is 0, hence GIN_SEARCH_MODE_ALL search mode is used. 2) column_name LIKE '%os%' same as in case (1) 3) column_name LIKE '%ost%' returned trglen is > 0, things proceed differently. May be, trigrams have been generated and cane be used for index search. I later commented out #define KEEPONLYALNUM from contrib/pg_trgm/trgm.h (following from a related discussion on -hackers viz. http://www.postgresql.org/message-id/flat/cahgqgwfjshvv2ngme19wdtw9tefw_w7h2ns4e+yysjkb9wd...@mail.gmail.com#cahgqgwfjshvv2ngme19wdtw9tefw_w7h2ns4e+yysjkb9wd...@mail.gmail.com), but things didn't change. So, it appears, for search strings consisting of 2 (or < 3) characters, trigrams can not be utilized. No? NOTE: Using the master branch. The indexed column is a text field and data consists of mix of Japanese, alphanumeric characters. -- Amit Langote -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers