Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using solr_parameters in config.add_search_field not working #90

Open
jogilder opened this issue Aug 15, 2018 · 0 comments
Open

Using solr_parameters in config.add_search_field not working #90

jogilder opened this issue Aug 15, 2018 · 0 comments

Comments

@jogilder
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant