pgroonga.rab in rabbit-slide-kou-pgconf-asia-2016-2016.12.3.0 vs pgroonga.rab in rabbit-slide-kou-pgconf-asia-2016-2016.12.3.1
- old
+ new
@@ -86,15 +86,14 @@
= FTS for Japanese2\n(('note:日本語の全文検索2'))
# coderay sql
CREATE EXTENSION pg_trgm;
- SELECT 'こんにちは' % 'にちは';
- -- ↑substring
- -- ?column?
- -- ----------
- -- f ← Must be "t"!
+ SELECT show_trgm('こんにちは');
+ -- show_trgm
+ -- -----------
+ -- {} ← Must not empty!
-- (1 row)
= Existing solution\n(('note:既存の解決策'))
(('tag:center'))
@@ -111,11 +110,11 @@
= pg_bigm: Usage\n(('note:pg_bigm:使い方'))
# coderay sql
CREATE INDEX index ON table
- USING gin (column gin_bigm_ops);
+ USING GIN (column gin_bigm_ops);
-- ↑Use GIN ↑Specify op class
= pg_bigm: Demerit\n(('note:pg_bigm:デメリット'))
* Slow for large document\n
@@ -217,11 +216,11 @@
* It means that "recheck" is slow\n
(('note:つまり「recheck」が遅いということ'))
= N-gram and "recheck"\n(('note:N-gramと「recheck」'))
- * N-gram approach needs "phrase search" when query has N or more characters\n
+ * N-gram approach needs "phrase search" when query has N+1 or more characters\n
(('note:N+1文字以上のクエリーには「フレーズ検索」が必要'))
* N=2 for pg_bigm, N=3 for pg_trgm\n
(('note:pg_bigmはN=2でpg_trgmはN=3'))
* (('wait'))GIN needs "recheck" for "phrase search"\n
@@ -371,10 +370,12 @@
= More about PGroonga\n(('note:PGroongaについてもっと'))
* Performance\n
(('note:性能'))
+ * Japanese specific feature\n
+ (('note:日本語向けの機能'))
* JSON support\n
(('note:JSONサポート'))
* Replication\n
(('note:レプリケーション'))
@@ -387,10 +388,16 @@
= Search and update\n(('note:検索と更新'))
* Doesn't decrease search performance while updating\n
(('note:更新中も検索性能が落ちない'))
+ * (('wait'))It's good characteristics for chat application\n
+ (('note:チャットアプリでうれしい傾向'))
+ * (('wait'))Zulip supports PGroonga\n
+ Zulip: OSS chat app by Dropbox\n
+ (('note:ZulipはPGroongaをサポートしている'))\n
+ (('note:ZulipはDropboxが開発しているOSSのチャットアプリ'))
= Characteristics\n(('note:傾向'))
# image
# src = images/performance-charcteristic-for-constant-read-and-write.svg
@@ -421,11 +428,11 @@
(('note:GINは間欠的な性能劣化がある'))
* For details:🔎"GIN pending list"\n
(('note:詳細は「GIN pending list」で検索'))
* PGroonga keeps fast search\n
(('note:PGroongaは高速な検索を維持'))
- * PGroonga keeps index latest\n
+ * PGroonga keeps index updated\n
(('note:PGroongaのインデックスは常に最新状態'))
= Index only scan\n(('note:インデックスオンリースキャン'))
* GIN: Not supported\n
@@ -460,9 +467,84 @@
(('note:インデックスオンリースキャンをサポート'))
* Direct Groonga search is more faster\n
(('note:Groonga直接検索はもっと速い'))
* Fast index creation\n
(('note:インデックス作成も速い'))
+
+= Japanese specific feature\n(('note:日本語向けの機能'))
+
+ * Completion by Romaji\n
+ (('note:ローマ字による入力補完'))
+
+= Completion: Table\n(('note:入力補完:テーブル'))
+
+ # coderay sql
+
+ CREATE TABLE stations (
+ name text,
+ readings text[]
+ -- ↑Support N readings
+ );
+
+= Completion: Data\n(('note:入力補完:データ'))
+
+ # coderay sql
+
+ INSERT INTO stations VALUES
+ ('Tokyo',
+ ARRAY['トウキョウ']),
+ -- ↑In Katakana
+ -- (...),
+ ('Akihabara',
+ ARRAY['アキハバラ', 'アキバ']);
+
+= Completion: Index\n(('note:入力補完:インデックス'))
+
+ # coderay sql
+
+ CREATE INDEX pgroonga_index
+ ON stations
+ USING pgroonga (
+ -- ↓For prefix and prefix Romaji/Katakana search
+ name pgroonga.text_term_search_ops_v2,
+ -- ↓For prefix and prefix Romaji/Katakana search
+ -- against array
+ readings pgroonga.text_array_term_search_ops_v2);
+
+= Completion: Search\n(('note:入力補完:検索'))
+
+ # coderay sql
+
+ SELECT name, readings
+ FROM stations
+ WHERE name &^ 'tou' OR
+ -- ↑Prefix search
+ readings &^~> 'tou'
+ -- ↑Prefix Romaji/Katakana search
+ ORDER BY name LIMIT 10;
+
+= Completion: Result\n(('note:入力補完:結果'))
+
+(('tag:center'))
+Hit by\n
+prefix Romaji/Katakana search\n
+"tou"(Romaji)→"トウ"(Katakana)\n
+(('note:前方一致RK検索でヒット'))
+
+ # _
+ name | readings
+ -------+--------------
+ Tokyo | {トウキョウ}
+ (1 row)
+
+= For Japanese: Wrap up\n(('note:日本語向け機能:まとめ'))
+
+ * Support prefix Romaji/Kana search\n
+ (('note:前方一致RK検索をサポート'))
+ * Useful for implementing auto complete feature in search box\n
+ (('note:検索欄にオートコンプリート機能を実装する時に便利'))
+ * Users don't need to convert Romaji to Kanji\n
+ (('note:ユーザーはローマ字を漢字に変換する必要がない'))
= JSON support\n(('note:JSONサポート'))
* Support full text search\n
(('note:全文検索対応'))