Skip to content

Instantly share code, notes, and snippets.

@myokoym
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myokoym/57a940ece5d1bf7d586a to your computer and use it in GitHub Desktop.
Save myokoym/57a940ece5d1bf7d586a to your computer and use it in GitHub Desktop.
Groongaチュートリアル(コピペ用) http://groonga.org/ja/docs/tutorial/introduction.html
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
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