Using solr_parameters in config.add_search_field not working
Opened this issue · 0 comments
Using solr 7.2.1. To get the correct and matching search results between our dropdown on main page and advanced search I am using solr_parameters rather than solr_local_parameters in config.add_search_field.
config.add_search_field 'default', label: 'All Fields' do |field| field.include_in_advanced_search = false field.solr_parameters = {df: 'default'} end
If there is an odd character entered in the search box or on the advanced search page (different field that is included) then I get a 400 error from solr. For example if I type 4081]
{:status=>400, :headers=>{"cache-control"=>["no-cache, no-store"], "pragma"=>["no-cache"], "expires"=>["Sat, 01 Jan 2000 01:00:00 GMT"], "last-modified"=>["Wed, 15 Aug 2018 13:56:39 GMT"], "etag"=>["\"1653ddfc53e\""], "content-type"=>["text/plain;charset=utf-8"], "connection"=>["close"]}, :body=>"{\n 'responseHeader'=>{\n 'status'=>400,\n 'QTime'=>1,\n 'params'=>{\n 'f.related_people_facet.facet.limit'=>'11',\n 'f.book_genres_facets.facet.mincount'=>'1',\n 'facet.field'=>['content_type',\n 'related_people_facet',\n 'poem_themes_facets',\n 'poem_genres_facets',\n 'book_genres_facets',\n 'gender',\n 'date_facet'],\n 'qt'=>'/browse',\n 'f.poem_themes_facets.facet.limit'=>'11',\n 'f.date_facet.facet.mincount'=>'1',\n 'fq'=>'is_displayed_content_type:1',\n 'f.book_genres_facets.facet.limit'=>'11',\n 'sort'=>'score desc',\n 'rows'=>'10',\n 'f.content_type.facet.mincount'=>'1',\n 'f.poem_themes_facets.facet.mincount'=>'1',\n 'f.gender.facet.mincount'=>'1',\n 'f.poem_genres_facets.facet.limit'=>'11',\n 'q'=>'4081]',\n 'qf'=>'default',\n 'f.related_people_facet.facet.mincount'=>'1',\n 'f.poem_genres_facets.facet.mincount'=>'1',\n 'stats'=>'true',\n 'wt'=>'ruby',\n 'facet'=>'true',\n 'stats.field'=>'date_facet'}},\n 'error'=>{\n 'metadata'=>[\n 'error-class','org.apache.solr.common.SolrException',\n 'root-error-class','org.apache.solr.parser.TokenMgrError'],\n 'msg'=>'org.apache.solr.search.SyntaxError: Cannot parse \\'4081]\\': Lexical error at line 1, column 6. Encountered: <EOF> after : \"\"',\n 'code'=>400}}\n"}
if I type "4081]" or if I use solr_local_parameters then I do not get this error.
I need to use solr_parameters so that the results returned are correct (we have edismax as default search).
Is there a problem with the quotes when using solr_parameters?
Do I need to tell users to use the quotes?