[Groonga-commit] groonga/fluent-plugin-droonga at 7f501eb [master] Detect float number correctly

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Wed May 29 14:48:27 JST 2013


YUKI Hiroshi	2013-05-29 14:48:27 +0900 (Wed, 29 May 2013)

  New Revision: 7f501ebc9f9558ffefba0d463972c47bfcdbbece
  https://github.com/groonga/fluent-plugin-droonga/commit/7f501ebc9f9558ffefba0d463972c47bfcdbbece

  Message:
    Detect float number correctly

  Modified files:
    lib/droonga/plugin/handler_search.rb

  Modified: lib/droonga/plugin/handler_search.rb (+5 -2)
===================================================================
--- lib/droonga/plugin/handler_search.rb    2013-05-29 14:46:45 +0900 (134da1a)
+++ lib/droonga/plugin/handler_search.rb    2013-05-29 14:48:27 +0900 (8267668)
@@ -268,7 +268,8 @@ module Droonga
         end
       end
 
-      STATIC_NUMBER_VALUE_PATTERN = /\A[-+]?[\d\.]+\z/.freeze
+      STATIC_INTEGER_VALUE_PATTERN = /\A[-+]?[\d]+\z/.freeze
+      STATIC_FLOAT_VALUE_PATTERN = /\A[-+]?[\d]*\.[\d]+\z/.freeze
       STATIC_STRING_VALUE_PATTERN = /\A("[^"]*"|'[^']*')\z/.freeze
 
       def normalize_target_attributes(attributes)
@@ -283,8 +284,10 @@ module Droonga
             source = attribute["source"]
             static_value = nil
             case source
-            when STATIC_NUMBER_VALUE_PATTERN
+            when STATIC_INTEVER_VALUE_PATTERN
              static_value = source.to_i
+            when STATIC_FLOAT_VALUE_PATTERN
+             static_value = source.to_f
             when STATIC_STRING_VALUE_PATTERN
              static_value = source[1..-2]
             end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index