[Groonga-commit] groonga/groonga [master] doc script syntax: add execution examples

Zurück zum Archiv-Index

null+****@clear***** null+****@clear*****
2012年 7月 23日 (月) 14:37:29 JST


Kouhei Sutou	2012-07-23 14:37:29 +0900 (Mon, 23 Jul 2012)

  New Revision: 7bb345f07922128ed1f75d06905805f2cdd72f62
  https://github.com/groonga/groonga/commit/7bb345f07922128ed1f75d06905805f2cdd72f62

  Log:
    doc script syntax: add execution examples

  Added files:
    doc/source/example/reference/grn_expr/script_syntax/simple_addition_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_bitwise_and_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_bitwise_not_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_bitwise_or_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_bitwise_xor_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_division_operator_quotient.log
    doc/source/example/reference/grn_expr/script_syntax/simple_division_operator_remainder.log
    doc/source/example/reference/grn_expr/script_syntax/simple_equal_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_function.log
    doc/source/example/reference/grn_expr/script_syntax/simple_grouping.log
    doc/source/example/reference/grn_expr/script_syntax/simple_left_shift_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_logical_and_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_logical_but_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_logical_not_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_logical_or_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_multiplication_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_not_equal_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_right_shift_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_signed_right_shift_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_subtraction_operator.log
    doc/source/example/reference/grn_expr/script_syntax/simple_unsigned_right_shift_operator.log
  Modified files:
    doc/source/reference/grn_expr/script_syntax.txt

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_addition_operator.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_addition_operator.log    2012-07-23 14:37:29 +0900 (49fd9bf)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter 'n_likes == 10 + 5'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         3, 
+  #         "Mroonga", 
+  #         "I also started to use mroonga. It's also very fast! Really fast!", 
+  #         15
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_bitwise_and_operator.log (+59 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_bitwise_and_operator.log    2012-07-23 14:37:29 +0900 (be523ce)
@@ -0,0 +1,59 @@
+Execution example::
+
+  select Entries --filter '(n_likes & 1) == 1'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         4
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         4, 
+  #         "Good-bye Senna", 
+  #         "I migrated all Senna system!", 
+  #         3
+  #       ], 
+  #       [
+  #         5, 
+  #         "Good-bye Tritonn", 
+  #         "I also migrated all Tritonn system!", 
+  #         3
+  #       ], 
+  #       [
+  #         3, 
+  #         "Mroonga", 
+  #         "I also started to use mroonga. It's also very fast! Really fast!", 
+  #         15
+  #       ], 
+  #       [
+  #         1, 
+  #         "The first post!", 
+  #         "Welcome! This is my first post!", 
+  #         5
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_bitwise_not_operator.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_bitwise_not_operator.log    2012-07-23 14:37:29 +0900 (539aeee)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter '~n_likes == -6'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         1, 
+  #         "The first post!", 
+  #         "Welcome! This is my first post!", 
+  #         5
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_bitwise_or_operator.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_bitwise_or_operator.log    2012-07-23 14:37:29 +0900 (1292740)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter 'n_likes == (1 | 4)'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         1, 
+  #         "The first post!", 
+  #         "Welcome! This is my first post!", 
+  #         5
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_bitwise_xor_operator.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_bitwise_xor_operator.log    2012-07-23 14:37:29 +0900 (c3c3863)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter 'n_likes == (10 ^ 15)'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         1, 
+  #         "The first post!", 
+  #         "Welcome! This is my first post!", 
+  #         5
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_division_operator_quotient.log (+47 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_division_operator_quotient.log    2012-07-23 14:37:29 +0900 (17cd48e)
@@ -0,0 +1,47 @@
+Execution example::
+
+  select Entries --filter 'n_likes == 26 / 7'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         2
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         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/reference/grn_expr/script_syntax/simple_division_operator_remainder.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_division_operator_remainder.log    2012-07-23 14:37:29 +0900 (c44e0d8)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter 'n_likes == 26 % 7'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         1, 
+  #         "The first post!", 
+  #         "Welcome! This is my first post!", 
+  #         5
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_equal_operator.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_equal_operator.log    2012-07-23 14:37:29 +0900 (a67ab63)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter 'n_likes == 5'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         1, 
+  #         "The first post!", 
+  #         "Welcome! This is my first post!", 
+  #         5
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_function.log (+47 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_function.log    2012-07-23 14:37:29 +0900 (4018ed2)
@@ -0,0 +1,47 @@
+Execution example::
+
+  select Entries --filter 'edit_distance(_key, "Groonga") <= 1'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         2
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         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
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_grouping.log (+92 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_grouping.log    2012-07-23 14:37:29 +0900 (edbf8cb)
@@ -0,0 +1,92 @@
+Execution example::
+
+  select Entries --filter 'n_likes < 5 && content @ "senna" || content @ "fast"'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         3
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         4, 
+  #         "Good-bye Senna", 
+  #         "I migrated all Senna system!", 
+  #         3
+  #       ], 
+  #       [
+  #         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
+  #       ]
+  #     ]
+  #   ]
+  # ]
+  select Entries --filter 'n_likes < 5 && (content @ "senna" || content @ "fast")'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         4, 
+  #         "Good-bye Senna", 
+  #         "I migrated all Senna system!", 
+  #         3
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_left_shift_operator.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_left_shift_operator.log    2012-07-23 14:37:29 +0900 (f3d2249)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter 'n_likes == (5 << 1)'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         2, 
+  #         "Groonga", 
+  #         "I started to use groonga. It's very fast!", 
+  #         10
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_logical_and_operator.log (+47 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_logical_and_operator.log    2012-07-23 14:37:29 +0900 (6b08a98)
@@ -0,0 +1,47 @@
+Execution example::
+
+  select Entries --filter 'content @ "fast" && n_likes >= 10'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         2
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         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
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_logical_but_operator.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_logical_but_operator.log    2012-07-23 14:37:29 +0900 (0ee1132)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter 'content @ "fast" &! content @ "mroonga"'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         2, 
+  #         "Groonga", 
+  #         "I started to use groonga. It's very fast!", 
+  #         10
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_logical_not_operator.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_logical_not_operator.log    2012-07-23 14:37:29 +0900 (9b8dd4c)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter '!(n_likes == 5)'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         1, 
+  #         "The first post!", 
+  #         "Welcome! This is my first post!", 
+  #         5
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_logical_or_operator.log (+47 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_logical_or_operator.log    2012-07-23 14:37:29 +0900 (a610ca0)
@@ -0,0 +1,47 @@
+Execution example::
+
+  select Entries --filter 'n_likes == 5 || n_likes == 10'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         2
+  #       ], 
+  #       [
+  #         [
+  #           "_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
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_multiplication_operator.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_multiplication_operator.log    2012-07-23 14:37:29 +0900 (b428240)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter 'n_likes == 3 * 5'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         3, 
+  #         "Mroonga", 
+  #         "I also started to use mroonga. It's also very fast! Really fast!", 
+  #         15
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_not_equal_operator.log (+59 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_not_equal_operator.log    2012-07-23 14:37:29 +0900 (d8fe862)
@@ -0,0 +1,59 @@
+Execution example::
+
+  select Entries --filter 'n_likes != 5'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         4
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         4, 
+  #         "Good-bye Senna", 
+  #         "I migrated all Senna system!", 
+  #         3
+  #       ], 
+  #       [
+  #         5, 
+  #         "Good-bye Tritonn", 
+  #         "I also migrated all Tritonn system!", 
+  #         3
+  #       ], 
+  #       [
+  #         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
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_right_shift_operator.log (+35 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_right_shift_operator.log    2012-07-23 14:37:29 +0900 (785df21)
@@ -0,0 +1,35 @@
+Execution example::
+
+  select Entries --filter 'n_likes == (-10 >>> 1)'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         0
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_signed_right_shift_operator.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_signed_right_shift_operator.log    2012-07-23 14:37:29 +0900 (3cd2025)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter 'n_likes == -(-10 >> 1)'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         1, 
+  #         "The first post!", 
+  #         "Welcome! This is my first post!", 
+  #         5
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_subtraction_operator.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_subtraction_operator.log    2012-07-23 14:37:29 +0900 (c5a5359)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter 'n_likes == 20 - 5'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         3, 
+  #         "Mroonga", 
+  #         "I also started to use mroonga. It's also very fast! Really fast!", 
+  #         15
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Added: doc/source/example/reference/grn_expr/script_syntax/simple_unsigned_right_shift_operator.log (+41 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/reference/grn_expr/script_syntax/simple_unsigned_right_shift_operator.log    2012-07-23 14:37:29 +0900 (b69d409)
@@ -0,0 +1,41 @@
+Execution example::
+
+  select Entries --filter 'n_likes == (2147483648 - (-10 >>> 1))'
+  # [
+  #   [
+  #     0, 
+  #     1337566253.89858, 
+  #     0.000355720520019531
+  #   ], 
+  #   [
+  #     [
+  #       [
+  #         1
+  #       ], 
+  #       [
+  #         [
+  #           "_id", 
+  #           "UInt32"
+  #         ], 
+  #         [
+  #           "_key", 
+  #           "ShortText"
+  #         ], 
+  #         [
+  #           "content", 
+  #           "Text"
+  #         ], 
+  #         [
+  #           "n_likes", 
+  #           "UInt32"
+  #         ]
+  #       ], 
+  #       [
+  #         1, 
+  #         "The first post!", 
+  #         "Welcome! This is my first post!", 
+  #         5
+  #       ]
+  #     ]
+  #   ]
+  # ]

  Modified: doc/source/reference/grn_expr/script_syntax.txt (+194 -28)
===================================================================
--- doc/source/reference/grn_expr/script_syntax.txt    2012-07-23 14:18:01 +0900 (60006f1)
+++ doc/source/reference/grn_expr/script_syntax.txt    2012-07-23 14:37:29 +0900 (2cfb43c)
@@ -156,25 +156,63 @@ control syntax.
 
 ``A ? B : C`` returns ``B`` if ``A`` is true, ``C`` otherwise.
 
-TODO: example
+Here is a simple exmaple.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_control_syntax_ternary_operator.log
+.. select Entries --filter 'n_likes == (_id == 1 ? 5 : 3)'
+
+The expression matches records that ``_id`` column value is equal to ``1``
+and ``n_likes`` column value is equal to ``5`` or ``_id`` column value is
+not equal to 1 and ``n_likes`` column value is equal to ``3``.
 
 Grouping
 --------
 
 Its syntax is ``(...)``. ``...`` is space separated expression list.
 
-TODO: description
+``(...)`` groups one ore more expressions and they can be processed as
+an expression. ``a && b || c`` means that ``a`` and ``b`` are matched
+or ``c`` is matched. ``a && (b || c)`` means that ``a`` and one of
+``b`` and ``c`` are matched.
+
+Here is a simple exmaple.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_grouping.log
+.. select Entries --filter 'n_likes < 5 && content @ "senna" || content @ "fast"'
+.. select Entries --filter 'n_likes < 5 && (content @ "senna" || content @ "fast")'
+
+The first expression doesn't use grouping. It matches records that
+``n_likes < 5`` and ``content @ "senna"`` are matched or
+``content @ "fast"`` is matched.
 
-TODO: example
+The second expression uses grouping. It matches records that ``n_likes
+< 5`` and one of ``content @ "senna"`` or ``content @ "fast"`` are
+matched.
 
 Function call
 -------------
 
 Its syntax is ``name(arugment1, argument2, ...)``.
 
-TODO: description
+``name(argument1, argument2, ...)`` calls a function that is named
+``name`` with arguments ``argument1``, ``argument2`` and ``...``.
 
-TODO: example
+See :doc:`/reference/functions/` for available functin list.
+
+Here is a simple exmaple.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_function.log
+.. select Entries --filter 'edit_distance(_key, "Groonga") <= 1'
+
+The expression uses :doc:`/reference/function/edit_distance`. It
+matches records that ``_key`` column value is ``"Groonga"`` like
+value. Similality of ``"Groonga"`` is computed as edit distance. If
+edit distance is less than or equal to 1, the value is treated as
+similar. In this case, ``"Groonga"`` and ``"Mroonga"`` are treated as
+similar.
 
 Basic operators
 ---------------
@@ -188,7 +226,14 @@ Its syntax is ``number1 * number2``.
 
 The operator multiplies ``number1`` and ``number2`` and returns the result.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_multiplication_operator.log
+.. select Entries --filter 'n_likes == 3 * 5'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``15`` (= ``3 * 5``).
 
 Addition operator
 ^^^^^^^^^^^^^^^^^
@@ -197,7 +242,14 @@ Its syntax is ``number1 + number2``.
 
 The operator adds ``number1`` and ``number2`` and returns the result.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_addition_operator.log
+.. select Entries --filter 'n_likes == 10 + 5'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``15`` (= ``10 + 5``).
 
 Subtraction operator
 ^^^^^^^^^^^^^^^^^^^^
@@ -206,7 +258,14 @@ Its syntax is ``number1 - number2``.
 
 The operator subtracts ``number2`` from ``number1`` and returns the result.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_subtraction_operator.log
+.. select Entries --filter 'n_likes == 20 - 5'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``15`` (= ``20 - 5``).
 
 Division operator
 ^^^^^^^^^^^^^^^^^
@@ -216,7 +275,21 @@ Its syntax is ``number1 / number2`` and ``number1 % number2``.
 The operator divides ``number2`` by ``number1``. ``/`` returns the
 quotient of result. ``%`` returns the remainder of result.
 
-TODO: example
+Here is simple examples.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_division_operator_quotient.log
+.. select Entries --filter 'n_likes == 26 / 7'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``3`` (= ``26 / 7``).
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_division_operator_remainder.log
+.. select Entries --filter 'n_likes == 26 % 7'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``5`` (= ``26 % 7``).
 
 Logical NOT operator
 ^^^^^^^^^^^^^^^^^^^^
@@ -225,7 +298,14 @@ Its syntax is ``!condition``.
 
 The operator inverts boolean value of ``condition``.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_logical_not_operator.log
+.. select Entries --filter '!(n_likes == 5)'
+
+The expression matches records that ``n_likes`` column value is not
+equal to ``5``.
 
 Bitwise NOT operator
 ^^^^^^^^^^^^^^^^^^^^
@@ -234,7 +314,14 @@ Its syntax is ``~number``.
 
 The operator returns bitwise NOT of ``number``.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_bitwise_not_operator.log
+.. select Entries --filter '~n_likes == -6'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``5`` because bitwise NOT of ``~5`` is ``-6``.
 
 Bitwise AND operator
 ^^^^^^^^^^^^^^^^^^^^
@@ -243,7 +330,16 @@ Its syntax is ``number1 & number2``.
 
 The operator returns bitwise AND between ``number1`` and ``number2``.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_bitwise_and_operator.log
+.. select Entries --filter '(n_likes & 1) == 1'
+
+The expression matches records that ``n_likes`` column value is even
+number because bitwise AND between an even number and ``1`` is equal
+to ``1`` and bitwise AND between an odd number and ``1`` is equal to
+``0``.
 
 Logical AND operator
 ^^^^^^^^^^^^^^^^^^^^
@@ -253,17 +349,32 @@ Its syntax is ``condition1 && condition2``.
 The operator returns true if both of ``condition1`` and
 ``condition2`` are true, false otherwise.
 
-TODO: example
+Here is a simple example.
 
-Logical NOT operator
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_logical_and_operator.log
+.. select Entries --filter 'content @ "fast" && n_likes >= 10'
+
+The expression matches records that ``content`` column value has the
+word ``fast`` and ``n_likes`` column value is greater or equal to
+``10``.
+
+Logical BUT operator
 ^^^^^^^^^^^^^^^^^^^^
 
 Its syntax is ``condition1 &! condition2``.
 
-The operator returns true if ``condition1`` is true but
-``condition2`` is false, false otherwise.
+The operator returns true if ``condition1`` is true but ``condition2``
+is false, false otherwise. It returns difference set.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_logical_but_operator.log
+.. select Entries --filter 'content @ "fast" &! content @ "mroonga"'
+
+The expression matches records that ``content`` column value has the
+word ``fast`` but doesn't have the word ``mroonga``.
 
 Left shift operator
 ^^^^^^^^^^^^^^^^^^^
@@ -273,7 +384,14 @@ Its syntax is ``number1 << number2``.
 The operator performs a bitwise left shift operation on ``number1`` by
 ``number2``.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_left_shift_operator.log
+.. select Entries --filter 'n_likes == (5 << 1)'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``10`` (= ``5 << 1``).
 
 Signed right shift operator
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -283,18 +401,31 @@ Its syntax is ``number1 >> number2``.
 The operator shifts bits of ``number1`` to right by ``number2``. The sign
 of the result is the same as ``number1``.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_signed_right_shift_operator.log
+.. select Entries --filter 'n_likes == -(-10 >> 1)'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``5`` (= ``-(-10 >> 1)`` = ``-(-5)``).
 
 Unsigned right shift operator
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Its syntax is ``number1 >>> number2``.
 
-The operator shifts bits of ``number1`` to right by ``number2``. If
-``number2`` is larger than 0, the sign of the result is always
-positive.
+The operator shifts bits of ``number1`` to right by ``number2``. The
+leftmost ``number2`` bits are filled by ``0``.
+
+Here is a simple example.
 
-TODO: example
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_unsigned_right_shift_operator.log
+.. select Entries --filter 'n_likes == (2147483648 - (-10 >>> 1))'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``5`` (= ``2147483648 - (-10 >>> 1)`` = ``2147483648 - 2147483643``).
 
 Bitwise OR operator
 ^^^^^^^^^^^^^^^^^^^
@@ -303,7 +434,14 @@ Its syntax is ``number1 | number2``.
 
 The operator returns bitwise OR between ``number1`` and ``number2``.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_bitwise_or_operator.log
+.. select Entries --filter 'n_likes == (1 | 4)'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``5`` (= ``1 | 4``).
 
 Bitwise XOR operator
 ^^^^^^^^^^^^^^^^^^^^
@@ -312,7 +450,14 @@ Its syntax is ``number1 ^ number2``.
 
 The operator returns bitwise XOR between ``number1`` and ``number2``.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_bitwise_xor_operator.log
+.. select Entries --filter 'n_likes == (10 ^ 15)'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``5`` (= ``10 ^ 15``).
 
 Logical OR operator
 ^^^^^^^^^^^^^^^^^^^
@@ -322,7 +467,14 @@ Its syntax is ``condition1 || condition2``.
 The operator returns true if either ``condition1`` or ``condition2`` is
 true, false otherwise.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_logical_or_operator.log
+.. select Entries --filter 'n_likes == 5 || n_likes == 10'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``5`` or ``10``.
 
 Equal operator
 ^^^^^^^^^^^^^^
@@ -332,7 +484,14 @@ Its syntax is ``object1 == object2``.
 The operator returns true if ``object1`` equals to ``object2``, false
 otherwise.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_equal_operator.log
+.. select Entries --filter 'n_likes == 5'
+
+The expression matches records that ``n_likes`` column value is equal
+to ``5``.
 
 Not equal operator
 ^^^^^^^^^^^^^^^^^^
@@ -342,7 +501,14 @@ Its syntax is ``object1 != object2``.
 The operator returns true if ``object1`` does not equal to
 ``object2``, false otherwise.
 
-TODO: example
+Here is a simple example.
+
+.. groonga-command
+.. include:: ../../example/reference/grn_expr/script_syntax/simple_not_equal_operator.log
+.. select Entries --filter 'n_likes != 5'
+
+The expression matches records that ``n_likes`` column value is not
+equal to ``5``.
 
 Assignment operators
 --------------------
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



Groonga-commit メーリングリストの案内
Zurück zum Archiv-Index