RSolr :: Error :: Http - 400 Bad Request

时间:2016-08-21 11:26:57

标签: ruby-on-rails solr sunspot sunspot-rails

我正在使用太阳黑子搜索我项目中的记录。 当我尝试用以下单词搜索记录时。

  • -
  • +
  • OR
  • AND
  • NOT

引发以下错误。

RSolr::Error::Http
RSolr::Error::Http - 400 Bad Request
Error: {'responseHeader'=>{'status'=>400,'QTime'=>1,
'params'=>{'f.search_class_s.facet.mincount'=>'1',
'facet'=>'true','fl'=>'* score','start'=>'0','q'=>'--','qf'=>'description_text',
'facet.field'=>'search_class_s','wt'=>'ruby','fq'=>['type:(Property)',
'(class_name:Property)','-deleted_at_d:[* TO *]'],'rows'=>'20','defType'=>'dismax'}},
'error'=>{'msg'=>'org.apache.solr.search.SyntaxError: 
Cannot parse \'--\': Encountered " "-" "- "" at line 1, column 1.

Was expecting one of:
    <BAREOPER> ...
    "(" ...
    "*" ...
    <QUOTED> ...
    <TERM> ...
    <PREFIXTERM> ...
    <WILDTERM> ...
    <REGEXPTERM> ...
    "[" ...

URI: http://52.71.60.36:8983/solr/Titjs0X0bQYHn/select?wt=ruby
Request Headers: {"Content-Type"=>"application/x-www-form-urlencoded; charset=UTF-8"}
Request Data: "fq=type%3A%28Attachment+OR+Property&q=--&fl=*+score&qf=description_text&defType=dismax&start=0&rows=20&facet=true&f.search_class_s.facet.mincount=1&facet.field=search_class_s"

Backtrace: /app/vendor/bundle/ruby/2.1.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:284:in `adapt_response'
/app/vendor/bundle/ruby/2.1.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:190:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/rsolr-1.0.13/lib/rsolr/client.rb:176:in `send_and_receive'
(eval):2:in `post'
/app/vendor/bundle/ruby/2.1.0/bundler/gems/sunspot-72f685596371/sunspot/lib/sunspot/search/abstract_search.rb:45:in `execute'
/app/vendor/bundle/ruby/2.1.0/bundler/gems/sunspot-72f685596371/sunspot/lib/sunspot/session.rb:59:in `search'
/app/vendor/bundle/ruby/2.1.0/bundler/gems/sunspot-72f685596371/sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `search'
/app/vendor/bundle/ruby/2.1.0/bundler/gems/sunspot-72f685596371/sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `search'
/app/vendor/bundle/ruby/2.1.0/bundler/gems/sunspot-72f685596371/sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `search'
/app/vendor/bundle/ruby/2.1.0/bundler/gems/sunspot-72f685596371/sunspot/lib/sunspot.rb:345:in `search'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/agent/method_tracer.rb:347:in `block in search_with_trace_SolrClient_Sunspot_query'

非常感谢任何帮助。

0 个答案:

没有答案