Fix issue where only facet.query was being requested but no fields

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@537760 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2007-05-14 09:36:05 +00:00
parent ca0dedf563
commit 9f596e279c
2 changed files with 25 additions and 12 deletions

View File

@ -71,6 +71,7 @@ class Solr::Request::Standard < Solr::Request::Select
hash["facet.missing"] = @params[:facets][:missing]
hash["facet.mincount"] = @params[:facets][:mincount]
hash["facet.prefix"] = @params[:facets][:prefix]
if @params[:facets][:fields] # facet fields are optional (could be facet.query only)
@params[:facets][:fields].each do |f|
if f.kind_of? Hash
key = f.keys[0]
@ -86,6 +87,7 @@ class Solr::Request::Standard < Solr::Request::Select
end
end
end
end
# highlighting parameter processing - http://wiki.apache.org/solr/HighlightingParameters
#TODO need to add per-field overriding to snippets, fragsize, requiredFieldMatch, formatting, and simple.pre/post

View File

@ -55,6 +55,17 @@ class StandardRequestTest < Test::Unit::TestCase
assert_match /debugQuery/, request.to_s
end
def test_only_facet_query
request = Solr::Request::Standard.new(:query => 'query',
:facets => {
:queries => ["q1", "q2"],
}
)
hash = request.to_hash
assert_equal ["q1", "q2"], hash["facet.query"]
end
def test_facet_params_all
request = Solr::Request::Standard.new(:query => 'query',
:facets => {