SET client_min_messages = warning; CREATE EXTENSION IF NOT EXISTS icu_parser CASCADE; RESET client_min_messages; SELECT alias, description FROM ts_token_type('icu') ORDER BY tokid; alias | description --------+-------------------------------- word | Word, letters blank | Space, punctuation and symbols number | Number kana | Kana word ideo | Ideographic word (5 rows) SELECT alias, token, lexemes FROM ts_debug('icu_simple', '東京駅前ラーメン店 ร้านกาแฟ Café McDonald''s 7-Eleven 3.5km'); alias | token | lexemes --------+------------+-------------- ideo | 東京 | {東京} ideo | 駅前 | {駅前} ideo | ラーメン | {ラーメン} ideo | 店 | {店} blank | | word | ร้าน | {ร้าน} word | กาแฟ | {กาแฟ} blank | | word | Café | {café} blank | | word | McDonald's | {mcdonald's} blank | | number | 7 | {7} blank | - | word | Eleven | {eleven} blank | | word | 3.5km | {3.5km} (17 rows) SELECT to_tsvector('icu_simple', 'Starbucks Coffee 星巴克咖啡 สตาร์บัคส์'); to_tsvector ------------------------------------------------------------------------- 'coffee':2 'starbucks':1 'ตาร์บัคส์':8 'ส':7 '克':5 '咖啡':6 '巴':4 '星':3 (1 row) SELECT to_tsvector('icu_simple', '東京駅前ラーメン店') @@ plainto_tsquery('icu_simple', 'ラーメン'); ?column? ---------- t (1 row) SELECT to_tsvector('icu_simple', 'ร้านกาแฟสด') @@ plainto_tsquery('icu_simple', 'กาแฟ'); ?column? ---------- t (1 row) SELECT to_tsvector('icu_simple', 'CAFÉ Ünïcode') @@ phraseto_tsquery('icu_simple', 'café ünïcode'); ?column? ---------- t (1 row) SELECT to_tsvector('icu_simple', ''); to_tsvector ------------- (1 row) SELECT to_tsvector('icu_simple', ' !!! '); to_tsvector ------------- (1 row) SELECT ts_headline('icu_simple', 'The best ラーメン in Tokyo', plainto_tsquery('icu_simple', 'ラーメン')); ts_headline ----------------------------------- The best ラーメン in Tokyo (1 row) CREATE TABLE icu_names (name text); INSERT INTO icu_names VALUES ('東京駅前ラーメン店'), ('Blue Bottle Coffee'), (NULL); CREATE INDEX ON icu_names USING gin (to_tsvector('icu_simple', name)); SET enable_seqscan = off; SELECT name FROM icu_names WHERE to_tsvector('icu_simple', name) @@ plainto_tsquery('icu_simple', 'ラーメン'); name -------------------- 東京駅前ラーメン店 (1 row) RESET enable_seqscan; DROP TABLE icu_names;