mirror of https://github.com/apache/lucene.git
fix mlt.fl
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@568955 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9c9d272e17
commit
8f752e08bb
|
@ -26,7 +26,7 @@ class Solr::Request::ModifyDocument < Solr::Request::Update
|
|||
if field_data
|
||||
field_data.each do |field_name, field_value|
|
||||
modes << "#{field_name}:#{mode.to_s.upcase}"
|
||||
@doc[field_name] = field_value
|
||||
@doc[field_name] = field_value if field_value # if value is nil, omit so it can be removed
|
||||
end
|
||||
update_data.delete mode
|
||||
end
|
||||
|
|
|
@ -104,7 +104,7 @@ class Solr::Request::Standard < Solr::Request::Select
|
|||
if @params[:mlt]
|
||||
hash[:mlt] = true
|
||||
hash["mlt.count"] = @params[:mlt][:count]
|
||||
hash["mlt.fl"] = @params[:mlt][:field_list]
|
||||
hash["mlt.fl"] = @params[:mlt][:field_list].join(',')
|
||||
hash["mlt.mintf"] = @params[:mlt][:min_term_freq]
|
||||
hash["mlt.mindf"] = @params[:mlt][:min_doc_freq]
|
||||
hash["mlt.minwl"] = @params[:mlt][:min_word_length]
|
||||
|
|
|
@ -16,9 +16,9 @@ require 'solr'
|
|||
class ModifyDocumentTest < Test::Unit::TestCase
|
||||
|
||||
def test_update_formatting
|
||||
request = Solr::Request::ModifyDocument.new(:id => 10, :overwrite => {:name => ['val1', 'val2']})
|
||||
request = Solr::Request::ModifyDocument.new(:id => 10, :overwrite => {:name => ['val1', 'val2'], :copyfield => nil})
|
||||
assert_equal :xml, request.response_format
|
||||
assert_equal 'update?mode=name:OVERWRITE', request.handler
|
||||
assert_equal 'update?mode=copyfield:OVERWRITE,name:OVERWRITE', request.handler
|
||||
|
||||
assert_match(/<add>[\s]*<doc>[\s]*<field name=["']id['"]>10<\/field>[\s]*<field name=['"]name['"]>val1<\/field>[\s]*<field name=['"]name['"]>val2<\/field>[\s]*<\/doc>[\s]*<\/add>/, request.to_s)
|
||||
end
|
||||
|
|
|
@ -132,7 +132,7 @@ class StandardRequestTest < Test::Unit::TestCase
|
|||
hash = request.to_hash
|
||||
assert_equal true, hash[:mlt]
|
||||
assert_equal 5, hash["mlt.count"]
|
||||
assert_equal ['field1', 'field2'], hash["mlt.fl"]
|
||||
assert_equal 'field1,field2', hash["mlt.fl"]
|
||||
assert_equal 3, hash["mlt.mintf"]
|
||||
assert_equal 10, hash["mlt.mindf"]
|
||||
assert_equal 4, hash["mlt.minwl"]
|
||||
|
|
Loading…
Reference in New Issue