Last active
August 29, 2015 14:07
-
-
Save myokoym/57a940ece5d1bf7d586a to your computer and use it in GitHub Desktop.
Groongaチュートリアル(コピペ用) http://groonga.org/ja/docs/tutorial/introduction.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
status | |
table_create --name Site --flags TABLE_HASH_KEY --key_type ShortText | |
select --table Site | |
column_create --table Site --name title --type ShortText | |
select --table Site | |
table_create --name Terms --flags TABLE_PAT_KEY|KEY_NORMALIZE --key_type ShortText --default_tokenizer TokenBigram | |
column_create --table Terms --name blog_title --flags COLUMN_INDEX|WITH_POSITION --type Site --source title | |
load --table Site | |
[ | |
{"_key":"http://example.org/","title":"This is test record 1!"}, | |
{"_key":"http://example.net/","title":"test record 2."}, | |
{"_key":"http://example.com/","title":"test test record three."}, | |
{"_key":"http://example.net/afr","title":"test record four."}, | |
{"_key":"http://example.org/aba","title":"test test test record five."}, | |
{"_key":"http://example.com/rab","title":"test test test test record six."}, | |
{"_key":"http://example.net/atv","title":"test test test record seven."}, | |
{"_key":"http://example.org/gat","title":"test test record eight."}, | |
{"_key":"http://example.com/vdw","title":"test test record nine."}, | |
] | |
select --table Site | |
select --table Site --query _id:1 | |
select --table Site --query '_key:"http://example.org/"' | |
select --table Site --query title:@this | |
select --table Site --match_columns title --query this | |
select --table Site --output_columns _key,title,_score --query title:@test | |
select --table Site --offset 0 --limit 3 | |
select --table Site --offset 3 --limit 3 | |
select --table Site --offset 7 --limit 3 | |
select --table Site --sortby -_id | |
select --table Site --query title:@test --output_columns _id,_score,title --sortby -_score | |
select --table Site --query title:@test --output_columns _id,_score,title --sortby -_score,_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
status | |
table_create --name Site --flags TABLE_HASH_KEY --key_type ShortText | |
select --table Site | |
column_create --table Site --name title --type ShortText | |
select --table Site | |
load --table Site | |
[ | |
{"_key":"http://example.org/","title":"This is test record 1!"}, | |
{"_key":"http://example.net/","title":"test record 2."}, | |
{"_key":"http://example.com/","title":"test test record three."}, | |
{"_key":"http://example.net/afr","title":"test record four."}, | |
{"_key":"http://example.org/aba","title":"test test test record five."}, | |
{"_key":"http://example.com/rab","title":"test test test test record six."}, | |
{"_key":"http://example.net/atv","title":"test test test record seven."}, | |
{"_key":"http://example.org/gat","title":"test test record eight."}, | |
{"_key":"http://example.com/vdw","title":"test test record nine."}, | |
] | |
select --table Site | |
select --table Site --query _id:1 | |
select --table Site --query '_key:"http://example.org/"' | |
table_create --name Terms --flags TABLE_PAT_KEY|KEY_NORMALIZE --key_type ShortText --default_tokenizer TokenBigram | |
column_create --table Terms --name blog_title --flags COLUMN_INDEX|WITH_POSITION --type Site --source title | |
select --table Site --query title:@this | |
select --table Site --match_columns title --query this | |
select --table Site --output_columns _key,title,_score --query title:@test | |
select --table Site --offset 0 --limit 3 | |
select --table Site --offset 3 --limit 3 | |
select --table Site --offset 7 --limit 3 | |
select --table Site --sortby -_id | |
select --table Site --query title:@test --output_columns _id,_score,title --sortby -_score | |
select --table Site --query title:@test --output_columns _id,_score,title --sortby -_score,_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment