[Groonga-commit] ranguba/groonga-client at ab7cee7 [master] Fix some arguments name of geo_in_rectangle.

Back to archive index

HorimotoYasuhiro null+****@clear*****
Thu Apr 27 15:40:24 JST 2017


HorimotoYasuhiro	2017-04-27 15:40:24 +0900 (Thu, 27 Apr 2017)

  New Revision: ab7cee7877f0db334764c2f5367aa574bf4c340a
  https://github.com/ranguba/groonga-client/commit/ab7cee7877f0db334764c2f5367aa574bf4c340a

  Merged 21cf21b: Merge pull request #19 from komainu8/feature/add_geo_in_rectangle

  Message:
    Fix some arguments name of geo_in_rectangle.

  Modified files:
    lib/groonga/client/request/select.rb
    test/request/select/test-filter.rb

  Modified: lib/groonga/client/request/select.rb (+11 -9)
===================================================================
--- lib/groonga/client/request/select.rb    2017-04-26 15:38:44 +0900 (17ce335)
+++ lib/groonga/client/request/select.rb    2017-04-27 15:40:24 +0900 (aa12b0b)
@@ -95,8 +95,8 @@ module Groonga
         #
         #   @example: Use geo_in_rectangle function
         #      request.
-        #        filter.geo_in_rectangle("50x50", "0x100", "100x0")
-        #          # -> --filter 'geo_in_rectangle("50x50", "0x100", "100x0")'
+        #        filter.geo_in_rectangle(:location, "0x100", "100x0")
+        #          # -> --filter 'geo_in_rectangle(location, "0x100", "100x0")'
         #
         #   @example Use geo_in_circle function
         #      request.
@@ -231,27 +231,29 @@ module Groonga
           #
           # @example: Basic usage
           #    request.
-          #      filter.geo_in_rectangle("50x50", "0x100", "100x0").
-          #        # -> --filter 'in_values(50x50, 0x100, 100x0)'
+          #      filter.geo_in_rectangle(:location, "0x100", "100x0").
+          #        # -> --filter 'in_values(location, 0x100, 100x0)'
           #
-          # @param point [String] The point to be checked.
-          #    `"#{LONGITUDE}x#{LATITUDE}"` is the point format.
+          # @param column_name [Symbol] The column name to be checked.
           #
           # @param top_left [String] The top left of the condition rectangle.
+          #    `"#{LONGITUDE}x#{LATITUDE}"` is the point format.
           #
           # @param bottom_right [String] The bottom right of the condition rectangle.
+          #    `"#{LONGITUDE}x#{LATITUDE}"` is the point format.
           #
           # @return [Groonga::Client::Request::Select]
           #   The new request with the given condition.
           #
           # @since 0.5.0
-          def geo_in_rectangle(point, top_left, bottom_right)
-            expression = "geo_in_rectangle(%{point}"
+          def geo_in_rectangle(column_name_or_point,
+                               top_left, bottom_right)
+            expression = "geo_in_rectangle(%{column_name_or_point}"
             expression << ", %{top_left}"
             expression << ", %{bottom_right}"
             expression << ")"
             @request.filter(expression,
-                            point: point,
+                            column_name_or_point: column_name_or_point,
                             top_left: top_left,
                             bottom_right: bottom_right)
           end

  Modified: test/request/select/test-filter.rb (+8 -0)
===================================================================
--- test/request/select/test-filter.rb    2017-04-26 15:38:44 +0900 (eddf374)
+++ test/request/select/test-filter.rb    2017-04-27 15:40:24 +0900 (307ebc0)
@@ -207,6 +207,14 @@ title == "[\"He\\ llo\"]"
         @request.filter.geo_in_rectangle(*args).to_parameters
       end
 
+      test("column") do
+        assert_equal({
+                       :table => "posts",
+                       :filter => "geo_in_rectangle(location, \"0x100\", \"100x0\")",
+                     },
+                     geo_in_rectangle(:location, "0x100", "100x0"))
+      end
+
       test("point") do
         assert_equal({
                        :table => "posts",
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index