# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'solr'
end
end
end
end
end
end
request = Solr::Request::Standard.new(:query => 'query', :debug_query => false, :facets => {:fields =>[:category_facet]})
end
:facets => {
}
)
hash = request.to_hash
end
:facets => {
# field that overrides the global facet parameters
{:year => {:limit => 50, :mincount => 0, :missing => false, :sort => :term, :prefix=>"199", :offset => 7}}],
:offset => 3, :limit => 5, :zeros => true, :mincount => 20, :sort => :count # global facet parameters
}
)
hash = request.to_hash
assert_equal true, hash[:facet]
assert_equal true, hash["facet.sort"]
assert_equal false, hash["f.year.facet.sort"]
end
request = Solr::Request::Standard.new(:query => 'query', :sort => [{:title => :descending}, {:date => :ascending}])
end
:highlighting => {
:merge_contiguous => true,
:increment => 100,
:max_snippets => 3,
:require_field_match => true,
:fragment_size => 300,
:max_analyzed_chars => 102400,
:use_phrase_highlighter => true
}
)
hash = request.to_hash
assert_equal true, hash[:hl]
assert_equal true, hash["hl.mergeContiguous"]
assert_equal true, hash["hl.requireFieldMatch"]
assert_equal true, hash["hl.usePhraseHighlighter"]
end
:highlighting => {
:merge_contiguous => {
},
:increment => {
},
:max_snippets => {
},
:prefix => {
},
:suffix => {
},
:fragment_size => {
},
:max_analyzed_chars => {
},
:require_field_match => {
},
:formatter => {
},
:fragmenter => {
},
}
)
hash = request.to_hash
assert_equal true, hash[:hl]
assert_equal false, hash["hl.mergeContiguous"]
assert_equal true, hash["f.author.hl.mergeContiguous"]
assert_equal false, hash["hl.requireFieldMatch"]
assert_equal true, hash["f.author.hl.requireFieldMatch"]
end
:highlighting => {
:regex => {
:slop => 0.8,
:max_analyzed_chars => 10000
}
}
)
hash = request.to_hash
assert_equal true, hash[:hl]
end
:highlighting => {
:regex => {
}
}
)
hash = request.to_hash
assert_equal true, hash[:hl]
end
:highlighting => {
:max_alternate_field_length => 30
}
)
hash = request.to_hash
assert_equal true, hash[:hl]
end
:highlighting => {
:alternate_field => {
},
}
}
)
hash = request.to_hash
assert_equal true, hash[:hl]
end
:highlighting => {
}
)
hash = request.to_hash
assert_equal true, hash[:hl]
end
:mlt => {
:min_term_freq => 3, :min_doc_freq => 10,
:min_word_length => 4, :max_word_length => 17,
:max_query_terms => 20, :max_tokens_parsed => 100,
:boost => true
}
)
hash = request.to_hash
assert_equal true, hash[:mlt]
end
end