読者です 読者をやめる 読者になる 読者になる

日記

検索エンジニアになりたい

groongaのチュートリアル4.1

groongaのチュートリアル4.1(
4.1. 基本的な操作 — Groonga v6.0.2ドキュメント
)を行った。基本的にはSQLのような操作。offset関数は指定した次の値から表示されるのに注意。

わからなかったこと
4.1.1.5検索結果の並び替えでの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の実行結果がWebページに記載されている結果と異なってしまう。
実行結果が整形されていない(なにか方法があった気がするので後で調べる)。
対話モードだと↑←が効かない。履歴を見たり打ち間違えた時に戻れなかったりするので不便。

haruka@ubuntu:~$ cd db
haruka@ubuntu:~/db$ groonga -n introduction.db
> status
[[0,1462724112.03547,0.0190560817718506],{"alloc_count":238,"starttime":1462724107,"start_time":1462724107,"uptime":5,"version":"6.0.1","n_queries":0,"cache_hit_rate":0.0,"command_version":1,"default_command_version":1,"max_command_version":2}]
> table list
-22,1462724516.96678,0.000232696533203125,"invalid command name: table",[["grn_ctx_qe_exec","ctx.c",1625]]
> column list
-22,1462724540.70943,0.000256776809692383,"invalid command name: column",[["grn_ctx_qe_exec","ctx.c",1625]]
> table_create --name Site --flags TABLE_HASH_KEY --key_type ShortText
[[0,1462724789.13796,0.0459518432617188],true]
> select --table Site
[[0,1462724846.46995,0.000674247741699219],[[[0],[["_id","UInt32"],["_key","ShortText"]]]]]
> column_create --table Site --name title --type ShortText
[[0,1462726805.2041,0.0678045749664307],true]
> select --table Site
[[0,1462726835.8324,0.000177860260009766],[[[0],[["_id","UInt32"],["_key","ShortText"],["title","ShortText"]]]]]
> load --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."},
][[-22,1462726888.33685,41.9003500938416,"JSON must start with '[' or '{': ","json_read","db.c",13278],0]
> -22,1462726930.23731,0.000177145004272461,"invalid command name: [",[["grn_ctx_qe_exec","ctx.c",1625]]
> -22,1462726930.23754,0.000164985656738281,"invalid command name: {",[["grn_ctx_qe_exec","ctx.c",1625]]
> -22,1462726930.23774,1.43051147460938e-05,"invalid command name: {",[["grn_ctx_qe_exec","ctx.c",1625]]
> -22,1462726930.23779,1.16825103759766e-05,"invalid command name: {",[["grn_ctx_qe_exec","ctx.c",1625]]
> -22,1462726930.23783,1.09672546386719e-05,"invalid command name: {",[["grn_ctx_qe_exec","ctx.c",1625]]
> -22,1462726930.23786,1.12056732177734e-05,"invalid command name: {",[["grn_ctx_qe_exec","ctx.c",1625]]
> -22,1462726930.2379,1.07288360595703e-05,"invalid command name: {",[["grn_ctx_qe_exec","ctx.c",1625]]
> -22,1462726930.23793,1.04904174804688e-05,"invalid command name: {",[["grn_ctx_qe_exec","ctx.c",1625]]
> -22,1462726930.23797,1.07288360595703e-05,"invalid command name: {",[["grn_ctx_qe_exec","ctx.c",1625]]
> -22,1462726930.238,1.07288360595703e-05,"invalid command name: {",[["grn_ctx_qe_exec","ctx.c",1625]]
>
[[-22,1462726935.97161,0.000230550765991211,"invalid command name: ]","grn_ctx_qe_exec","ctx.c",1625]]
> 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."},
]> > > > > > > > > > >
[[0,1462726961.04945,5.56129145622253],9]
> select --table Site
[[0,1462727019.55979,0.000241994857788086],[[[9],[["_id","UInt32"],["_key","ShortText"],["title","ShortText"]],[1,"http://example.org/","This is test record 1!"],[2,"http://example.net/","test record 2."],[3,"http://example.com/","test test record three."],[4,"http://example.net/afr","test record four."],[5,"http://example.org/aba","test test test record five."],[6,"http://example.com/rab","test test test test record six."],[7,"http://example.net/atv","test test test record seven."],[8,"http://example.org/gat","test test record eight."],[9,"http://example.com/vdw","test test record nine."]]]]
> select --table Site --query _id:1
[[0,1462727071.14666,0.0910372734069824],[[[1],[["_id","UInt32"],["_key","ShortText"],["title","ShortText"]],[1,"http://example.org/","This is test record 1!"]]]]
> select --table Site --query '_key:"http://example.org/"'
[[0,1462727156.25137,0.00113058090209961],[[[1],[["_id","UInt32"],["_key","ShortText"],["title","ShortText"]],[1,"http://example.org/","This is test record 1!"]]]]
> table_create --name Terms --flags TABLE_PAT_KEY --key_type ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
[[0,1462727328.51775,0.0586590766906738],true]
> select --table Site --offset 0 --limit3
[[0,1462758572.72974,0.00013279914855957],[[[9],[["_id","UInt32"],["_key","ShortText"],["title","ShortText"]],[1,"http://example.org/","This is test record 1!"],[2,"http://example.net/","test record 2."],[3,"http://example.com/","test test record three."],[4,"http://example.net/afr","test record four."],[5,"http://example.org/aba","test test test record five."],[6,"http://example.com/rab","test test test test record six."],[7,"http://example.net/atv","test test test record seven."],[8,"http://example.org/gat","test test record eight."],[9,"http://example.com/vdw","test test record nine."]]]]
> select --table Site -- offset 0 -- limit 3
-22,1462758640.96341,0.000414133071899414,"invalid table name: <-->",[["grn_select","proc_select.c",877]]
> select --table Site --offset 0 --limit 3
[[0,1462758666.76998,0.000222206115722656],[[[9],[["_id","UInt32"],["_key","ShortText"],["title","ShortText"]],[1,"http://example.org/","This is test record 1!"],[2,"http://example.net/","test record 2."],[3,"http://example.com/","test test record three."]]]]
> select --table Site --offset 3 --limit 3
[[0,1462758745.12413,0.00038909912109375],[[[9],[["_id","UInt32"],["_key","ShortText"],["title","ShortText"]],[4,"http://example.net/afr","test record four."],[5,"http://example.org/aba","test test test record five."],[6,"http://example.com/rab","test test test test record six."]]]]
> select --table Site --offset 7 --limit 3
[[0,1462758791.24307,0.000257968902587891],[[[9],[["_id","UInt32"],["_key","ShortText"],["title","ShortText"]],[8,"http://example.org/gat","test test record eight."],[9,"http://example.com/vdw","test test record nine."]]]]
> select --table Site --sortby -_id
[[0,1462758849.9427,0.000440359115600586],[[[9],[["_id","UInt32"],["_key","ShortText"],["title","ShortText"]],[9,"http://example.com/vdw","test test record nine."],[8,"http://example.org/gat","test test record eight."],[7,"http://example.net/atv","test test test record seven."],[6,"http://example.com/rab","test test test test record six."],[5,"http://example.org/aba","test test test record five."],[4,"http://example.net/afr","test record four."],[3,"http://example.com/","test test record three."],[2,"http://example.net/","test record 2."],[1,"http://example.org/","This is test record 1!"]]]]
> select --table Site --sortby -_key
[[0,1462758910.3005,0.000372648239135742],[[[9],[["_id","UInt32"],["_key","ShortText"],["title","ShortText"]],[8,"http://example.org/gat","test test record eight."],[5,"http://example.org/aba","test test test record five."],[1,"http://example.org/","This is test record 1!"],[7,"http://example.net/atv","test test test record seven."],[4,"http://example.net/afr","test record four."],[2,"http://example.net/","test record 2."],[9,"http://example.com/vdw","test test record nine."],[6,"http://example.com/rab","test test test test record six."],[3,"http://example.com/","test test record three."]]]]
> select --table Sit --query title:@test --output_colums _id,_score,title --sortby -_score
[[-22,1462759019.66426,0.000590085983276367,"invalid table name: ","grn_select","proc_select.c",877]]
> select --table Sit --query title:@test --output_colums _id,_score,title --sortby -_score
[[-22,1462759033.99363,8.7738037109375e-05,"invalid table name: ","grn_select","proc_select.c",877]]
> select --table Site --query title:@test --output_colums _id,_score,title --sortby -_score
[[0,1462759091.04822,0.033463716506958],[[[9],[["_id","UInt32"],["_key","ShortText"],["title","ShortText"]],[1,"http://example.org/","This is test record 1!"],[9,"http://example.com/vdw","test test record nine."],[3,"http://example.com/","test test record three."],[5,"http://example.org/aba","test test test record five."],[4,"http://example.net/afr","test record four."],[6,"http://example.com/rab","test test test test record six."],[8,"http://example.org/gat","test test record eight."],[7,"http://example.net/atv","test test test record seven."],[2,"http://example.net/","test record 2."]]]]
> select --table Site --query title:@test --output_columns _id,_score,title --sortby -_score
[[0,1462759198.70156,0.00127553939819336],[[[9],[["_id","UInt32"],["_score","Int32"],["title","ShortText"]],[1,1,"This is test record 1!"],[9,1,"test test record nine."],[3,1,"test test record three."],[5,1,"test test test record five."],[4,1,"test record four."],[6,1,"test test test test record six."],[8,1,"test test record eight."],[7,1,"test test test record seven."],[2,1,"test record 2."]]]]
> select --table Site --query title:@test --output_columns _id,_score,title --sortby -_score,_id
[[0,1462760159.56464,0.00125956535339355],[[[9],[["_id","UInt32"],["_score","Int32"],["title","ShortText"]],[1,1,"This is test record 1!"],[2,1,"test record 2."],[3,1,"test test record three."],[4,1,"test record four."],[5,1,"test test test record five."],[6,1,"test test test test record six."],[7,1,"test test test record seven."],[8,1,"test test record eight."],[9,1,"test test record nine."]]]]
>