null+****@clear*****
null+****@clear*****
2012年 5月 20日 (日) 20:50:49 JST
Kouhei Sutou 2012-05-20 20:50:49 +0900 (Sun, 20 May 2012) New Revision: d8d078f2d24d9433de13ea3997fac9e2916b37dc Log: doc: add offset and limit Added files: doc/source/example/commands/select/limit_negative.log doc/source/example/commands/select/limit_simple.log doc/source/example/commands/select/offset_negative.log doc/source/example/commands/select/offset_simple.log Modified files: doc/source/commands/select.txt Modified: doc/source/commands/select.txt (+45 -4) =================================================================== --- doc/source/commands/select.txt 2012-05-20 20:37:15 +0900 (629e4cc) +++ doc/source/commands/select.txt 2012-05-20 20:50:49 +0900 (afadb19) @@ -609,16 +609,57 @@ it's just ignored but get a warning in log file. ``offset`` """""""""" -TODO: write in English and add example. +It specifies offset to choose output records range. Offset is +zero-origin. ``--offset 1`` means output range is started from the 2nd +record. + +.. groonga-command +.. include:: ../example/commands/select/offset_simple.log +.. select Entries --sortby _id --offset 3 --output_columns _key -検索条件にマッチしたレコードのうち、出力対象となる最初のレコードの番号を0ベースで指定します。デフォルト値は0です。offsetに負の値を指定した場合は、ヒットした件数 + offset によって算出される値が指定されたものとみなされます。 +The ``select`` command outputs from the 4th record. + +You can specify negative value. It means that ``the number of matched +records + offset``. If you have 3 matched records and specify +``--offset -2``, you get records from the 1st (``3 + -2 = 1``) record +to the 3rd record. + +.. groonga-command +.. include:: ../example/commands/select/offset_negative.log +.. select Entries --sortby _id --offset -2 --output_columns _key + +The ``select`` command outputs from the 4th record because the total +number of records is ``5``. + +The default value is ``0``. ``limit`` """"""""" -TODO: write in English and add example. +It specifies the max number of output records. If the number of +matched records is less than ``limit``, all records are outputted. + +Here is a simple ``limit`` usage example. + +.. groonga-command +.. include:: ../example/commands/select/limit_simple.log +.. select Entries --sortby _id --offset 2 --limit 3 --output_columns _key + +The ``select`` command outputs the 3rd, the 4th and the 5th records. + +You can specify negative value. It means that ``the number of matched +records + limit + 1``. For example, ``--limit -1`` outputs all +records. It's very useful value to show all records. + +Here is a simple negative ``limit`` value usage example. + +.. groonga-command +.. include:: ../example/commands/select/limit_negative.log +.. select Entries --limit -1 + +The ``select`` command outputs all records. -検索条件にマッチしたレコードのうち、出力を行うレコードの件数を指定します。デフォルト値は10です。実際には、offset + limit がヒットした件数を超えない範囲でレコードが出力されます。limitに負の値を指定した場合は、ヒットした件数 + limit + 1 によって算出される値が指定されたものとみなされます。 +The default value is ``10``. ``scorer`` """""""""" Added: doc/source/example/commands/select/limit_negative.log (+65 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/commands/select/limit_negative.log 2012-05-20 20:50:49 +0900 (aee4fa2) @@ -0,0 +1,65 @@ +Execution example:: + + select Entries --limit -1 + # [ + # [ + # 0, + # 1337514625.393, + # 0.000154495239257812 + # ], + # [ + # [ + # [ + # 5 + # ], + # [ + # [ + # "_id", + # "UInt32" + # ], + # [ + # "_key", + # "ShortText" + # ], + # [ + # "content", + # "Text" + # ], + # [ + # "n_likes", + # "UInt32" + # ] + # ], + # [ + # 1, + # "The first post!", + # "Welcome! This is my first post!", + # 5 + # ], + # [ + # 2, + # "Groonga", + # "I started to use groonga. It's very fast!", + # 10 + # ], + # [ + # 3, + # "Mroonga", + # "I also started to use mroonga. It's also very fast! Really fast!", + # 15 + # ], + # [ + # 4, + # "Good-bye Senna", + # "I migrated all Senna system!", + # 3 + # ], + # [ + # 5, + # "Good-bye Tritonn", + # "I also migrated all Tritonn system!", + # 3 + # ] + # ] + # ] + # ] Added: doc/source/example/commands/select/limit_simple.log (+32 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/commands/select/limit_simple.log 2012-05-20 20:50:49 +0900 (b25e51c) @@ -0,0 +1,32 @@ +Execution example:: + + select Entries --sortby _id --offset 2 --limit 3 --output_columns _key + # [ + # [ + # 0, + # 1337514556.64099, + # 0.000263690948486328 + # ], + # [ + # [ + # [ + # 5 + # ], + # [ + # [ + # "_key", + # "ShortText" + # ] + # ], + # [ + # "Mroonga" + # ], + # [ + # "Good-bye Senna" + # ], + # [ + # "Good-bye Tritonn" + # ] + # ] + # ] + # ] Added: doc/source/example/commands/select/offset_negative.log (+29 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/commands/select/offset_negative.log 2012-05-20 20:50:49 +0900 (e60aff1) @@ -0,0 +1,29 @@ +Execution example:: + + select Entries --sortby _id --offset -2 --output_columns _key + # [ + # [ + # 0, + # 1337514624.98869, + # 0.000284671783447266 + # ], + # [ + # [ + # [ + # 5 + # ], + # [ + # [ + # "_key", + # "ShortText" + # ] + # ], + # [ + # "Good-bye Senna" + # ], + # [ + # "Good-bye Tritonn" + # ] + # ] + # ] + # ] Added: doc/source/example/commands/select/offset_simple.log (+29 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/commands/select/offset_simple.log 2012-05-20 20:50:49 +0900 (2bd41eb) @@ -0,0 +1,29 @@ +Execution example:: + + select Entries --sortby _id --offset 3 --output_columns _key + # [ + # [ + # 0, + # 1337514624.78646, + # 0.000315666198730469 + # ], + # [ + # [ + # [ + # 5 + # ], + # [ + # [ + # "_key", + # "ShortText" + # ] + # ], + # [ + # "Good-bye Senna" + # ], + # [ + # "Good-bye Tritonn" + # ] + # ] + # ] + # ]