spec/models/blacklight/solr/search_builder_spec.rb in blacklight-7.15.2 vs spec/models/blacklight/solr/search_builder_spec.rb in blacklight-7.16.0
- old
+ new
@@ -319,9 +319,41 @@
expect(key_value_pairs).to include("pf=$subject_pf")
expect(key_value_pairs).to include("qf=$subject_qf")
end
end
+ describe "solr json query parameters from the fielded search" do
+ let(:user_params) { subject_search_params }
+
+ before do
+ blacklight_config.search_fields['subject'].solr_parameters = {
+ some: :parameter
+ }
+
+ blacklight_config.search_fields['subject'].clause_params = {
+ edismax: {
+ another: :parameter
+ }
+ }
+ end
+
+ it 'sets solr parameters from the field' do
+ expect(subject[:some]).to eq :parameter
+ end
+
+ it 'does not set a q parameter' do
+ expect(subject).not_to have_key :q
+ end
+
+ it 'includes the user query in the JSON query DSL request' do
+ expect(subject.dig(:json, :query, :bool, :must, 0, :edismax)).to include query: 'wome'
+ end
+
+ it 'includes addtional clause parameters for the field' do
+ expect(subject.dig(:json, :query, :bool, :must, 0, :edismax)).to include another: :parameter
+ end
+ end
+
describe "overriding of qt parameter" do
let(:user_params) do
{ qt: 'overridden' }
end