Skip to content

Commit

Permalink
Fix a bug that scorer required 2 arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed May 31, 2017
1 parent 637f370 commit 3bc8b10
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/groonga/client/request/select.rb
Expand Up @@ -143,7 +143,7 @@ def filter(*args)
end
end

def scorer(expression_or_column_name, values_or_value)
def scorer(expression_or_column_name, values_or_value=nil)
case expression_or_column_name
when Symbol
expression = "_score = %{column}"
Expand Down
7 changes: 4 additions & 3 deletions test/request/select/test-scorer.rb
@@ -1,4 +1,5 @@
# Copyright (C) 2016-2017 Yasuhiro Horimoto <horimoto@clear-code.com>
# Copyright (C) 2017 Yasuhiro Horimoto <horimoto@clear-code.com>
# Copyright (C) 2017 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand All @@ -19,8 +20,8 @@ class TestRequestSelectScorer < Test::Unit::TestCase
@request = Groonga::Client::Request::Select.new("posts")
end

def scorer(expression, values=nil)
@request.scorer(expression, values).to_parameters
def scorer(*args)
@request.scorer(*args).to_parameters
end

sub_test_case("expression") do
Expand Down

0 comments on commit 3bc8b10

Please sign in to comment.