Skip to content

Apache Lucene open-source search software

Add support for alternate field highlighting, based on patch by Koji Sekiguchi on SOLR-376

Erik Hatcher66b05d1da59f
diff --git a/client/ruby/solr-ruby/CHANGES.yml b/client/ruby/solr-ruby/CHANGES.yml
index 193a7c7cc99..656a051aca7 100644
--- a/client/ruby/solr-ruby/CHANGES.yml
+++ b/client/ruby/solr-ruby/CHANGES.yml
@@ -4,6 +4,7 @@ v0.0.6:
- Added Solr::Request::Spellcheck
- Enabled Solr::Requst::Select to work as a general pass through to any registered request handler
- Fixed modify_document_test.rb so as to not be brittle with Hash ordering
+ - Added support for alternate field highlighting to Solr::Request::Standard (and thus DisMax)
v0.0.5:
release_date: 2007-08-27
diff --git a/client/ruby/solr-ruby/lib/solr/request/standard.rb b/client/ruby/solr-ruby/lib/solr/request/standard.rb
index cf9ee052b85..1548e151f06 100755
--- a/client/ruby/solr-ruby/lib/solr/request/standard.rb
+++ b/client/ruby/solr-ruby/lib/solr/request/standard.rb
@@ -99,6 +99,11 @@ class Solr::Request::Standard < Solr::Request::Select
hash["hl.simple.pre"] = @params[:highlighting][:prefix]
hash["hl.simple.post"] = @params[:highlighting][:suffix]
hash["hl.fragsize"] = @params[:highlighting][:fragment_size]
+ if @params[:highlighting][:alternate_fields]
+ @params[:highlighting][:alternate_fields].each do |k,v|
+ hash["f.#{k}.hl.alternateField"] = v
+ end
+ end
end
if @params[:mlt]