[Groonga-commit] groonga/groonga [master] doc select: add description about filter parameter

Back to archive index

null+****@clear***** null+****@clear*****
2012年 5月 8日 (火) 16:40:35 JST


Kouhei Sutou	2012-05-08 16:40:35 +0900 (Tue, 08 May 2012)

  New Revision: 53a6684cab22bc670cddf8e9ce1751391e84522a

  Log:
    doc select: add description about filter parameter

  Added files:
    doc/source/example/commands/select/filter_equal.log
    doc/source/example/commands/select/filter_less_than.log
  Modified files:
    doc/source/commands/select.txt

  Modified: doc/source/commands/select.txt (+30 -2)
===================================================================
--- doc/source/commands/select.txt    2012-05-08 16:19:49 +0900 (eb8a04d)
+++ doc/source/commands/select.txt    2012-05-08 16:40:35 +0900 (0c922b8)
@@ -349,9 +349,37 @@ See :doc:`/spec/query_syntax` for other operations.
 ``filter``
 """"""""""
 
-TODO: write short description and add example.
+It specifies the filter text. Normally, it is used for complex search
+conditions. ``filter`` can be used with ``query`` parameter. If both
+``filter`` and ``query`` are specified, there are conbined with
+logical and. It means that matched records shuold be matched against
+both ``filter`` and ``query``.
+
+``filter`` parameter is desgined for complex conditions. A filter text
+should be formated in :doc:`/spec/script_syntax`. The syntax is
+similar to ECMAScript. For example, ``column == "value"`` means that
+the ``column`` column equals to ``"value"``. ``column < value`` means
+that the value of ``column`` column is less than ``value``.
 
-See :doc:`/spec/script_syntax`.
+Here is a simple equality operator search example.
+
+.. groonga-command
+.. include:: ../example/commands/select/filter_equal.log
+.. select Entries --filter '_key == "Groonga"'
+
+The ``select`` command searches records that ``_key`` column value is
+``Groonga`` from ``Entries`` table.
+
+Here is a simple less than operator search example.
+
+.. groonga-command
+.. include:: ../example/commands/select/filter_less_than.log
+.. select Entries --filter 'n_likes < 11'
+
+The ``select`` command searches records that ``n_likes`` column value
+is less than ``11`` from ``Entries`` table.
+
+See :doc:`/spec/script_syntax` for other operations.
 
 Advanced search parameters
 ^^^^^^^^^^^^^^^^^^^^^^^^^^

  Added: doc/source/example/commands/select/filter_equal.log (+42 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/commands/select/filter_equal.log    2012-05-08 16:40:35 +0900 (d041378)
@@ -0,0 +1,42 @@
+Execution example::
+
+  > select Entries --filter '_key == "Groonga"'
+  [
+    [
+      0, 
+      1336462400.98305, 
+      0.000327587127685547
+    ], 
+    [
+      [
+        [
+          1
+        ], 
+        [
+          [
+            "_id", 
+            "UInt32"
+          ], 
+          [
+            "_key", 
+            "ShortText"
+          ], 
+          [
+            "content", 
+            "Text"
+          ], 
+          [
+            "n_likes", 
+            "UInt32"
+          ]
+        ], 
+        [
+          2, 
+          "Groonga", 
+          "I started to use groonga. It's very fast!", 
+          10
+        ]
+      ]
+    ]
+  ]
+  
\ No newline at end of file

  Added: doc/source/example/commands/select/filter_less_than.log (+48 -0) 100644
===================================================================
--- /dev/null
+++ doc/source/example/commands/select/filter_less_than.log    2012-05-08 16:40:35 +0900 (97e409d)
@@ -0,0 +1,48 @@
+Execution example::
+
+  > select Entries --filter 'n_likes < 11'
+  [
+    [
+      0, 
+      1336462401.18486, 
+      0.000334024429321289
+    ], 
+    [
+      [
+        [
+          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
+        ]
+      ]
+    ]
+  ]
+  
\ No newline at end of file




Groonga-commit メーリングリストの案内
Back to archive index