我正在使用Solr 6.1.0而不使用 Cloud 模式,
我在solrconfig.xml中添加了searchhandler,它的工作正常,可以看到搜索结果
但是当我使用这个搜索处理程序并在URL中添加查询时,它会出错
像这样 :
这是我的搜索处理程序:
<requestHandler name="/contentsearch" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">explicit</str>
<str name="wt">json</str>
<str name="indent">true</str>
<str name="defType">edismax</str>
<str name="qf">
title^100.0 content^80.0 text^5.0
</str>
<str name="q">*:*</str>
<str name="indent">true</str>
<str name="rows">10</str>
<!-- Facet settings -->
<str name="facet">on</str>
<str name="facet.field">content_type</str>
<str name="facet.field">category</str>
<str name="facet.field">author</str>
<str name="facet.field">editor</str>
<str name="facet.field">source_type</str>
<str name="hl">on</str>
<str name="hl.fl">title content</str>
<str name="hl.preserveMulti">true</str>
</lst>
<arr name="last-components">
<str>elevator</str>
</arr>
</requestHandler>
错误信息 :
================================================== =======================
{“responseHeader”:{“status”:404,“QTime”:10,“params”:{“q”:“\”test \“”,“shards”:“localhost:8983 / solr / testcorea,localhost :8983 / solr的/ testcoreb,本地主机:8983 / solr的/ testcorec,本地主机:8983 / solr的/ testcored”, “缩进”: “上”, “重量”: “JSON”}}, “错误”:{ “元数据” : “错误级”, “org.apache.solr.client.solrj.impl.HttpSolrClient $ RemoteSolrException”, “根本错误级”,“org.apache.solr.client.solrj.impl.HttpSolrClient $ RemoteSolrException “],”msg“:”来自http:// localhost:8983 / solr / testcorec的服务器出错:预期的mime类型application / octet-stream但得到text / html . \ n \ n \ n错误404 Not Found \ n \ ñ
HTTP错误404
\ n
访问/ solr / testcorec / contentsearch时遇到问题 . 原因:\ n
Not Found
\ n \ n \ n "," code“:404}}
当我使用solr默认searchhandlr和查询url它会工作像这样:
有谁知道有什么不同?
为什么它不起作用?
谢谢
1 回答
将突出显示参数添加到URL .
将hl = on和hl.fl = field_name添加到您的网址
例如:
hl.fl=title&hl=on&indent=on&q=test