null+****@clear*****
null+****@clear*****
2010年 7月 26日 (月) 14:51:25 JST
Tasuku SUENAGA a.k.a. gunyarakun 2010-07-26 05:51:25 +0000 (Mon, 26 Jul 2010)
New Revision: 63f5efc564eedb1affb4744153fe30db14b6e56d
Log:
Fixed documentation bugs.
Modified files:
doc/ja/source/tutorial/tutorial01.txt
doc/ja/source/tutorial/tutorial02.txt
doc/ja/source/tutorial/tutorial03.txt
doc/ja/source/tutorial/tutorial04.txt
doc/ja/source/tutorial/tutorial05.txt
Modified: doc/ja/source/tutorial/tutorial01.txt (+18 -17)
===================================================================
--- doc/ja/source/tutorial/tutorial01.txt 2010-07-23 07:59:03 +0000 (b6f827d)
+++ doc/ja/source/tutorial/tutorial01.txt 2010-07-26 05:51:25 +0000 (f529727)
@@ -2,6 +2,7 @@
.. groonga-command
.. table_remove Site
+.. table_remove Terms
インストールと基本的な操作
==========================
@@ -76,7 +77,7 @@ DBの操作
たとえば、statusというコマンドを実行してみましょう。statusコマンドは、groongaの実行状態を返すコマンドです。
.. groonga-command
-.. include:: ../example//tutorial01-1.log
+.. include:: ../example/tutorial01-1.log
.. .. % groonga /tmp/tutorial.db
.. status
@@ -130,7 +131,7 @@ groongaでは、多くの場合テーブルを作成する際に主キーが必
ここでは、ShortText型の主キー値を持ち、主キーの格納方法はHASHである、'Site'という名前のテーブルを作成します。
.. groonga-command
-.. include:: ../example//tutorial01-2.log
+.. include:: ../example/tutorial01-2.log
.. table_create --name Site --flags TABLE_HASH_KEY --key_type ShortText
検索
@@ -139,7 +140,7 @@ groongaでは、多くの場合テーブルを作成する際に主キーが必
:doc:`../commands/select` コマンドを用いて、テーブルの中身を表示することができます。
.. groonga-command
-.. include:: ../example//tutorial01-3.log
+.. include:: ../example/tutorial01-3.log
.. select --table Site
selectにテーブル名を指定すると、指定したテーブルの中身を10件表示します。[0]は検索されたレコードの件数、["_id","Uint32"]は値がUInt32型である"_id'という名前のカラム、["_key","ShortText"]は値がShortText型である'_key'という名前のカラムを示しています。
@@ -154,7 +155,7 @@ table_createコマンドで作成したテーブルには、最初から'_id'/'_
ShortText型の値を持つ、'comment'という名前のカラムを'Site'テーブルに追加しましょう。
.. groonga-command
-.. include:: ../example//tutorial01-4.log
+.. include:: ../example/tutorial01-4.log
.. column_create --table Site --name title --flags COLUMN_SCALAR --type ShortText
.. select --table Site
@@ -170,7 +171,7 @@ COLUMN_SCALARについては、通常のカラムであることを示してい
ここでは、ShortText型の主キー値を持つ、'Terms'という名前のテーブルを作成しました。
.. groonga-command
-.. include:: ../example//tutorial01-5.log
+.. include:: ../example/tutorial01-5.log
.. table_create --name Terms --flags TABLE_PAT_KEY|KEY_NORMALIZE --key_type ShortText --default_tokenizer TokenBigram
この実行例には、多くのパラメータが指定されています。本チュートリアルでは、これらをすべて理解する必要はありません。以下に簡単な説明を記しますが、読み飛ばしてもらってかまいません。
@@ -185,7 +186,7 @@ COLUMN_SCALARについては、通常のカラムであることを示してい
Siteテーブルのtitleカラムを全文検索の対象としたいとしましょう。その場合には、語彙テーブルにインデックス型のカラムを作成します。
.. groonga-command
-.. include:: ../example//tutorial01-6.log
+.. include:: ../example/tutorial01-6.log
.. column_create --table Terms --name blog_title --flags COLUMN_INDEX|WITH_POSITION --type Site --source title
Siteテーブルのtitleカラムを検索対象とする、'blog_title'という名前のインデックス型カラムをTermsテーブルに作成しました。インデックス対象となるテーブルをtypeに、インデックス対象となるカラムをsourceに指定します。
@@ -198,7 +199,7 @@ Siteテーブルのtitleカラムを検索対象とする、'blog_title'とい
:doc:`../commands/load` コマンドを使用します。loadコマンドでは、jsonで受け取ったデータをテーブルに格納します。
.. groonga-command
-.. include:: ../example//tutorial01-7.log
+.. include:: ../example/tutorial01-7.log
.. load --table Site
.. [
.. {"_key":"http://example.org/","title":"This is test record 1!"},
@@ -215,7 +216,7 @@ Siteテーブルのtitleカラムを検索対象とする、'blog_title'とい
selectコマンドで、データが入っていることを確認しましょう。
.. groonga-command
-.. include:: ../example//tutorial01-8.log
+.. include:: ../example/tutorial01-8.log
.. select --table Site
データの検索
@@ -226,7 +227,7 @@ groongaでは、'_id'カラムと'_key'カラムの値はテーブル中で一
selectコマンドにおいて、queryパラメータを用いるとデータの検索を行うことができます。
.. groonga-command
-.. include:: ../example//tutorial01-9.log
+.. include:: ../example/tutorial01-9.log
.. select --table Site --query _id:1
queryパラメータに与えた「_id:1」というのは、'_id'という名前のカラムに'1'という値が入っているレコードを検索する、という意味です。
@@ -234,7 +235,7 @@ queryパラメータに与えた「_id:1」というのは、'_id'という名
_keyでも検索してみましょう。
.. groonga-command
-.. include:: ../example//tutorial01-10.log
+.. include:: ../example/tutorial01-10.log
.. select --table Site --query "_key:\"http://example.org/\""
queryパラメータに与えた「_key:\"http://example.org/\"」というのは、'_key'という名前のカラムに'"http://example.org/"'という値が入っているレコードを検索する、という意味です。
@@ -245,7 +246,7 @@ queryパラメータに与えた「_key:\"http://example.org/\"」というの
queryパラメータでは、インデックスを用いた全文検索を行うこともできます。
.. groonga-command
-.. include:: ../example//tutorial01-11.log
+.. include:: ../example/tutorial01-11.log
.. select --table Site --query title:@this
titleカラムに対して、'this'という文字列で全文検索を行った結果を返します。
@@ -257,7 +258,7 @@ selectコマンドには、match_columnsというパラメータが存在しま
match_columnsパラメータに'title'、queryパラメータに'this'という文字列を指定すると、上記のクエリと同じ結果を得ることができます。
.. groonga-command
-.. include:: ../example//tutorial01-12.log
+.. include:: ../example/tutorial01-12.log
.. select --table Site --match_columns title --query this
出力カラムの指定
@@ -268,7 +269,7 @@ selectコマンドにおいて、output_columnsパラメータを用いること
複数のカラムを指定する場合は、カンマ(,)区切りで指定します。
.. groonga-command
-.. include:: ../example//tutorial01-13.log
+.. include:: ../example/tutorial01-13.log
.. select --table Site --output_columns _key,title,_score --query title:@test
groongaの検索結果には、「_score」という名前のカラムが追加されています。このカラムは、全文検索の条件が合致する文書ほど高い数値が入ります。
@@ -284,7 +285,7 @@ offsetパラメータには、検索結果を返す始点を指定します。1
limitパラメータには、検索結果を何件表示するのかを指定します。
.. groonga-command
-.. include:: ../example//tutorial01-14.log
+.. include:: ../example/tutorial01-14.log
.. select --table Site --offset 0 --limit 3
.. select --table Site --offset 3 --limit 3
.. select --table Site --offset 7 --limit 3
@@ -297,19 +298,19 @@ selectコマンドにおいて、sortbyパラメータを用いることで、
sortbyパラメータにカラム名を指定することで、そのカラムの値で昇順にソートします。また、カラム名の前にハイフン(-)を付けることで、降順にソートすることも出来ます。
.. groonga-command
-.. include:: ../example//tutorial01-15.log
+.. include:: ../example/tutorial01-15.log
.. select --table Site --sortby -_id
出力カラムの指定で紹介した「_score」カラムは、ソートの条件としても使うことができます。
.. groonga-command
-.. include:: ../example//tutorial01-16.log
+.. include:: ../example/tutorial01-16.log
.. select --table Site --query title:@test --output_columns _id,_score,title --sortby _score
ソートするカラム名を複数指定したい場合は、カンマ(,)区切りで指定します。複数のカラムを指定した場合、最初のカラムで同一の値のレコードがあった場合に、次のカラムの値でソートさせることができます。
.. groonga-command
-.. include:: ../example//tutorial01-17.log
+.. include:: ../example/tutorial01-17.log
.. select --table Site --query title:@test --output_columns _id,_score,title --sortby _score,_id
.. rubric:: 脚注
Modified: doc/ja/source/tutorial/tutorial02.txt (+11 -6)
===================================================================
--- doc/ja/source/tutorial/tutorial02.txt 2010-07-23 07:59:03 +0000 (e884ba3)
+++ doc/ja/source/tutorial/tutorial02.txt 2010-07-26 05:51:25 +0000 (6c0b66f)
@@ -1,5 +1,7 @@
.. highlightlang:: none
+.. groonga-include : tutorial01.txt
+
ネットワークを通じた利用
========================
@@ -81,13 +83,16 @@ groongaがHTTPプロトコルモードで起動されているとき、「/d/コ
コマンドのオプションは、HTTPのGETパラメータで渡します。つまり、「?オプション=値&オプション=値 …」という書式になります。
-実行例 ::
-
- http://[IPまたはホスト名]:[ポート番号]/d/status
- レスポンス:[[0,1270106793.0733,5.6e-05],{"alloc_count":171,"starttime":1270106348,"uptime":445,"version":"0.1.8-4-g4404d63"}]
+.. groonga-command
+.. include:: ../example/tutorial02-3.log
+.. .. http://[IPまたはホスト名]:[ポート番号]/d/status
+.. .. 実行される処理:
+.. status
+.. ..
+.. .. http://[IPまたはホスト名]:[ポート番号]/d/select?table=Site&query=title:@this
+.. .. 実行される処理:
+.. select --table Site --query title:@this
- http://[IPまたはホスト名]:[ポート番号]/d/select?table=Site&query=title:@this
- レスポンス:[[0,1270106743.60756,0.000903],[[[1],[["_id","UInt32"],["_key","ShortText"],["title","ShortText"]],[1,"http../example/.org/","This is test record 1!"]]]]
セキュリティ
------------
Modified: doc/ja/source/tutorial/tutorial03.txt (+2 -2)
===================================================================
--- doc/ja/source/tutorial/tutorial03.txt 2010-07-23 07:59:03 +0000 (cf98b07)
+++ doc/ja/source/tutorial/tutorial03.txt 2010-07-26 05:51:25 +0000 (97c86aa)
@@ -44,7 +44,7 @@ table_createで作成したテーブルを、カラムの型として使うこ
.. include:: ../example/tutorial03-2.log
.. column_create --table Site --name link --type Site
.. load --table Site
-.. [{"_key":"http../example/.org/","link":"http../example/.net/"}]
+.. [{"_key":"http://example.org/","link":"http://example.net/"}]
.. select --table Site --output_columns _key,title,link._key,link.title --query title:@this
このように、linkカラムに他のサイトへの参照を保存することができました。また、参照先の_keyとtitleカラムの内容を表示することができました。
@@ -66,7 +66,7 @@ column_createコマンドでカラムを作成するとき、--flagsオプショ
.. include:: ../example/tutorial03-3.log
.. column_create --table Site --name links --flags COLUMN_VECTOR --type Site
.. load --table Site
-.. [{"_key":"http../example/.org/","links":["http../example/.net/","http../example/.org/","http../example/.com/"]}]
+.. [{"_key":"http://example.org/","links":["http://example.net/","http://example.org/","http://example.com/"]}]
.. select --table Site --output_columns _key,title,links._key,links.title --query title:@this
このように、複数の参照関係が保存できました。また、output_columnsによって、複数の参照先のカラム値も表示させることができました。
Modified: doc/ja/source/tutorial/tutorial04.txt (+4 -4)
===================================================================
--- doc/ja/source/tutorial/tutorial04.txt 2010-07-23 07:59:03 +0000 (3a81361)
+++ doc/ja/source/tutorial/tutorial04.txt 2010-07-26 05:51:25 +0000 (43166a4)
@@ -42,8 +42,8 @@ JavaScriptの式に似たな文法で様々な条件を指定することがで
.. groonga-command
.. include:: ../example/tutorial04-3.log
-.. select --table Site --scorer "_score = rand()" --output_columns _id,_key,_score --sortby _score
-.. select --table Site --scorer "_score = rand()" --output_columns _id,_key,_score --sortby _score
+.. select --table Site --filter "1" --scorer "_score = rand()" --output_columns _id,_key,_score --sortby _score
+.. select --table Site --filter "1" --scorer "_score = rand()" --output_columns _id,_key,_score --sortby _score
検索結果には、'_score'という名前の、全文検索のスコアが代入されている仮想的なカラムが付与されることをチュートリアル中ソートの項目で説明しました。
@@ -77,8 +77,8 @@ groongaでは、位置情報(経緯度)を保存することができます
.. column_create --table Site --name location --type WGS84GeoPoint
.. load --table Site
.. [
-.. {"_key":"http../example/.org/","location":"128452975x503157902"}
-.. {"_key":"http../example/.net/","location":"128487316x502920929"},
+.. {"_key":"http://example.org/","location":"128452975x503157902"}
+.. {"_key":"http://example.net/","location":"128487316x502920929"},
.. ]
.. select --table Site --query "_id:1 OR _id:2" --output_columns _key,location
Modified: doc/ja/source/tutorial/tutorial05.txt (+9 -9)
===================================================================
--- doc/ja/source/tutorial/tutorial05.txt 2010-07-23 07:59:03 +0000 (b4a81d6)
+++ doc/ja/source/tutorial/tutorial05.txt 2010-07-26 05:51:25 +0000 (897a19e)
@@ -21,15 +21,15 @@ Siteテーブルに2つのカラムを追加します。TLDドメイン名を
.. column_create --table Site --name country --flags COLUMN_SCALAR --type SiteCountry
.. load --table Site
.. [
-.. {"_key":"http../example/.org/","domain":".org","country":"japan"},
-.. {"_key":"http../example/.net/","domain":".net","country":"brazil"},
-.. {"_key":"http../example/.com/","domain":".com","country":"japan"},
-.. {"_key":"http../example/.net/afr","domain":".net","country":"usa"},
-.. {"_key":"http../example/.org/aba","domain":".org","country":"korea"},
-.. {"_key":"http../example/.com/rab","domain":".com","country":"china"},
-.. {"_key":"http../example/.net/atv","domain":".net","country":"china"},
-.. {"_key":"http../example/.org/gat","domain":".org","country":"usa"},
-.. {"_key":"http../example/.com/vdw","domain":".com","country":"japan"}
+.. {"_key":"http://example.org/","domain":".org","country":"japan"},
+.. {"_key":"http://example.net/","domain":".net","country":"brazil"},
+.. {"_key":"http://example.com/","domain":".com","country":"japan"},
+.. {"_key":"http://example.net/afr","domain":".net","country":"usa"},
+.. {"_key":"http://example.org/aba","domain":".org","country":"korea"},
+.. {"_key":"http://example.com/rab","domain":".com","country":"china"},
+.. {"_key":"http://example.net/atv","domain":".net","country":"china"},
+.. {"_key":"http://example.org/gat","domain":".org","country":"usa"},
+.. {"_key":"http://example.com/vdw","domain":".com","country":"japan"}
.. ]
domainカラムとcountryカラムでドリルダウンを行う例を以下に示します。