[Groonga-commit] groonga/groonga at abcb4f4 [master] Fixed the update method of `key_name` and the condition to sort `result_sets` in reverse order

アーカイブの一覧に戻る

HorimotoYasuhiro null+****@clear*****
Thu Oct 26 11:39:40 JST 2017


HorimotoYasuhiro	2017-10-26 11:39:40 +0900 (Thu, 26 Oct 2017)

  New Revision: abcb4f41a6ae47c30b110c62710204bf9f2446ab
  https://github.com/groonga/groonga/commit/abcb4f41a6ae47c30b110c62710204bf9f2446ab

  Merged c53e0f9: Merge pull request #773 from komainu8/reverse-logical-select

  Message:
    Fixed the update method of `key_name` and the condition to sort `result_sets` in reverse order

  Modified files:
    lib/mrb/scripts/table.rb
    plugins/sharding/logical_select.rb

  Modified: lib/mrb/scripts/table.rb (+3 -3)
===================================================================
--- lib/mrb/scripts/table.rb    2017-10-25 19:42:06 +0900 (9caff6e53)
+++ lib/mrb/scripts/table.rb    2017-10-26 11:39:40 +0900 (ba4b7a1d4)
@@ -102,7 +102,7 @@ module Groonga
         order    = key[:order] || order
         offset   = key[:offset] || offset
       else
-        key_name = key.dup
+        key_name = key
       end
 
       case key_name
@@ -117,10 +117,10 @@ module Groonga
       end
 
       if key_name.start_with?("-")
-        key_name[0] = ""
+        key_name = key_name[1..-1]
         order = :descending
       elsif key_name.start_with?("+")
-        key_name[0] = ""
+        key_name = key_name[1..-1]
       end
 
       key = find_column(key_name)

  Modified: plugins/sharding/logical_select.rb (+1 -3)
===================================================================
--- plugins/sharding/logical_select.rb    2017-10-25 19:42:06 +0900 (cb77320c2)
+++ plugins/sharding/logical_select.rb    2017-10-26 11:39:40 +0900 (658926bb2)
@@ -152,10 +152,8 @@ module Groonga
             :offset => current_offset,
             :limit => current_limit,
           }
-          context.sort_keys.each do |sort_key|
-            if sort_key.match("-timestamp")
+          if context.sort_keys.any? {|sort_key| sort_key.start_with?("-")}
               result_sets = result_sets.reverse
-            end
           end
           result_sets.each do |result_set|
             if result_set.size > current_offset
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20171026/156b3705/attachment-0001.htm 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る