| 1 |
table_create Entries TABLE_NO_KEY |
| 2 |
column_create Entries body COLUMN_SCALAR ShortText |
| 3 |
|
| 4 |
table_create Terms TABLE_PAT_KEY ShortText \ |
| 5 |
--default_tokenizer 'TokenNgram("report_source_location", true)' \ |
| 6 |
--normalizer 'NormalizerNFKC150' |
| 7 |
column_create Terms document_index COLUMN_INDEX|WITH_POSITION Entries body |
| 8 |
|
| 9 |
load --table Entries |
| 10 |
[ |
| 11 |
{"body": "斉藤 一代さん"}, |
| 12 |
{"body": "斉藤の一人"} |
| 13 |
] |
| 14 |
|
| 15 |
# "斉藤" doesn't need prefix search but "一" needs prefix search. |
| 16 |
# Because the number of characters of "一" is 1 that is less than 2 |
| 17 |
# (TokenNgram uses 2 chracters for one token by default). |
| 18 |
# |
| 19 |
# grn_highlighter calls keywords that need the prefix search as |
| 20 |
# "lazy keywords". "斉藤" isn't a lazy keyword and "一" is a lazy keyword. |
| 21 |
select Entries \ |
| 22 |
--match_columns body \ |
| 23 |
--query '斉藤 一' \ |
| 24 |
--output_columns 'highlight_html(body, Terms)' |