[Groonga-commit] ranguba/rroonga at e00c380 [master] Support no weight match column case

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Feb 24 17:03:52 JST 2014


Kouhei Sutou	2014-02-24 17:03:52 +0900 (Mon, 24 Feb 2014)

  New Revision: e00c3805198466fccfb780056d17f996bfbf2c0b
  https://github.com/ranguba/rroonga/commit/e00c3805198466fccfb780056d17f996bfbf2c0b

  Message:
    Support no weight match column case
    
        table.select do |record|
          match_target = record.match_target do |target|
            target.column
          end
          match_target =~ keyword
        end

  Modified files:
    lib/groonga/expression-builder.rb
    test/test-table-select-weight.rb

  Modified: lib/groonga/expression-builder.rb (+2 -4)
===================================================================
--- lib/groonga/expression-builder.rb    2014-02-21 16:59:22 +0900 (108d361)
+++ lib/groonga/expression-builder.rb    2014-02-24 17:03:52 +0900 (2d8a6f1)
@@ -79,10 +79,8 @@ module Groonga
         end
       end
 
-      if builders.empty? or builders == [self]
-        expression.append_constant(1)
-        expression.append_constant(1)
-        expression.append_operation(Groonga::Operation::OR, 2)
+      if builders.empty?
+        expression.append_constant(true)
       else
         combined_builder = builders.inject(nil) do |previous, builder|
           if previous.nil?

  Modified: test/test-table-select-weight.rb (+12 -0)
===================================================================
--- test/test-table-select-weight.rb    2014-02-21 16:59:22 +0900 (5a006b6)
+++ test/test-table-select-weight.rb    2014-02-24 17:03:52 +0900 (09432a9)
@@ -120,4 +120,16 @@ class TableSelectWeightTest < Test::Unit::TestCase
       [record.title, record.score]
     end
   end
+
+  def test_one_column_only
+    result =****@comme***** do |record|
+      record.match("Hello") do |match_record|
+        match_record.title
+      end
+    end
+    assert_equal_select_result([["Hello", 1]],
+                               result) do |record|
+      [record.title, record.score]
+    end
+  end
 end
-------------- next part --------------
HTML����������������������������...
다운로드 



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