[Groonga-commit] groonga/groonga at 78dfe73 [master] logical_range_filter: extract code for building cursor flags

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Feb 25 14:14:32 JST 2015


Kouhei Sutou	2015-02-25 14:14:32 +0900 (Wed, 25 Feb 2015)

  New Revision: 78dfe73fab557e7f72e749b2931621128880f3dd
  https://github.com/groonga/groonga/commit/78dfe73fab557e7f72e749b2931621128880f3dd

  Message:
    logical_range_filter: extract code for building cursor flags

  Modified files:
    plugins/sharding/logical_range_filter.rb

  Modified: plugins/sharding/logical_range_filter.rb (+24 -19)
===================================================================
--- plugins/sharding/logical_range_filter.rb    2015-02-25 14:12:15 +0900 (764301a)
+++ plugins/sharding/logical_range_filter.rb    2015-02-25 14:14:32 +0900 (a34cae6)
@@ -196,25 +196,7 @@ module Groonga
                             min, min_border, max, max_border)
           lexicon = range_index.domain
           data_table = range_index.range
-          flags = TableCursorFlags::BY_KEY
-          case @order
-          when :ascending
-            flags |= TableCursorFlags::ASCENDING
-          when :descending
-            flags |= TableCursorFlags::DESCENDING
-          end
-          case min_border
-          when :include
-            flags |= TableCursorFlags::GE
-          when :exclude
-            flags |= TableCursorFlags::GT
-          end
-          case max_border
-          when :include
-            flags |= TableCursorFlags::LE
-          when :exclude
-            flags |= TableCursorFlags::LT
-          end
+          flags = build_range_search_flags(min_border, max_border)
 
           result_set = HashTable.create(:flags => ObjectFlags::WITH_SUBREC,
                                         :key_type => data_table)
@@ -262,6 +244,29 @@ module Groonga
           @result_sets << result_set
         end
 
+        def build_range_search_flags(min_border, max_border)
+          flags = TableCursorFlags::BY_KEY
+          case @order
+          when :ascending
+            flags |= TableCursorFlags::ASCENDING
+          when :descending
+            flags |= TableCursorFlags::DESCENDING
+          end
+          case min_border
+          when :include
+            flags |= TableCursorFlags::GE
+          when :exclude
+            flags |= TableCursorFlags::GT
+          end
+          case max_border
+          when :include
+            flags |= TableCursorFlags::LE
+          when :exclude
+            flags |= TableCursorFlags::LT
+          end
+          flags
+        end
+
         def filter_table(table, filter)
           create_expression(table) do |expression|
             if block_given?
-------------- next part --------------
HTML����������������������������...
Download 



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