| 1 |
table_create Tags TABLE_PAT_KEY ShortText |
| 2 |
|
| 3 |
table_create Products TABLE_HASH_KEY ShortText |
| 4 |
column_create Products tags COLUMN_VECTOR|WITH_WEIGHT Tags |
| 5 |
|
| 6 |
table_create Programmers TABLE_PAT_KEY ShortText |
| 7 |
column_create Programmers products COLUMN_VECTOR Products |
| 8 |
|
| 9 |
load --table Products |
| 10 |
[ |
| 11 |
{ |
| 12 |
"_key": "Groonga", |
| 13 |
"tags": { |
| 14 |
"groonga": 100 |
| 15 |
} |
| 16 |
}, |
| 17 |
{ |
| 18 |
"_key": "Mroonga", |
| 19 |
"tags": { |
| 20 |
"mroonga": 100, |
| 21 |
"groonga": 50 |
| 22 |
} |
| 23 |
}, |
| 24 |
{ |
| 25 |
"_key": "Rroonga", |
| 26 |
"tags": { |
| 27 |
"ruby": 100, |
| 28 |
"groonga": 10 |
| 29 |
} |
| 30 |
}, |
| 31 |
{ |
| 32 |
"_key": "TST", |
| 33 |
"tags": { |
| 34 |
"mozilla": 100 |
| 35 |
} |
| 36 |
} |
| 37 |
] |
| 38 |
|
| 39 |
load --table Programmers |
| 40 |
[ |
| 41 |
{ |
| 42 |
"_key": "daijiro", |
| 43 |
"products": [ |
| 44 |
"Groonga", |
| 45 |
"Mroonga" |
| 46 |
] |
| 47 |
}, |
| 48 |
{ |
| 49 |
"_key": "kou", |
| 50 |
"products": [ |
| 51 |
"Groonga", |
| 52 |
"Mroonga", |
| 53 |
"Rroonga" |
| 54 |
] |
| 55 |
}, |
| 56 |
{ |
| 57 |
"_key": "maruyama", |
| 58 |
"products": [ |
| 59 |
"Mroonga" |
| 60 |
] |
| 61 |
}, |
| 62 |
{ |
| 63 |
"_key": "piro", |
| 64 |
"products": [ |
| 65 |
"TST" |
| 66 |
] |
| 67 |
} |
| 68 |
] |
| 69 |
|
| 70 |
column_create Tags products_tags COLUMN_INDEX|WITH_WEIGHT Products tags |
| 71 |
|
| 72 |
column_create Products programmers_products COLUMN_INDEX Programmers products |
| 73 |
|
| 74 |
select Programmers \ |
| 75 |
--match_columns 'products.tags * 10' \ |
| 76 |
--query groonga \ |
| 77 |
--output_columns _key,_score |