1CREATE TABLE memos (
2  content text
3);
4INSERT INTO memos VALUES ('090-1234-5678');
5INSERT INTO memos VALUES ('(090)1234-5678');
6CREATE INDEX pgrn_index ON memos
7 USING pgroonga (content pgroonga_text_full_text_search_ops_v2)
8  WITH (tokenizer = 'TokenNgram("loose_symbol", true)');
9SET enable_seqscan = off;
10SET enable_indexscan = on;
11SET enable_bitmapscan = off;
12\pset format unaligned
13EXPLAIN (COSTS OFF)
14SELECT content, pgroonga_score(tableoid, ctid)
15  FROM memos
16 WHERE content &@
17       ('090-12345678',
18        ARRAY[5],
19        'pgrn_index')::pgroonga_full_text_search_condition
20\g |sed -r -e "s/('.+'|ROW.+)::pgroonga/pgroonga/g"
21QUERY PLAN
22Index Scan using pgrn_index on memos
23  Index Cond: (content &@ pgroonga_full_text_search_condition)
24(2 rows)
25\pset format aligned
26SELECT content, pgroonga_score(tableoid, ctid)
27  FROM memos
28 WHERE content &@
29       ('090-12345678',
30        ARRAY[5],
31        'pgrn_index')::pgroonga_full_text_search_condition;
32    content     | pgroonga_score
33----------------+----------------
34 090-1234-5678  |              5
35 (090)1234-5678 |              5
36(2 rows)
37
38DROP TABLE memos;
39