我有一个 Solr 实例在我的 Ubuntu 机器上运行,使用 Solr 下载附带的默认 Jetty 服务器。每当我开始使用 Solr
java -jar start.jar
服务器启动正常,但总是抛出异常:
INFO: SolrDispatchFilter.init() done
Apr 12, 2012 2:01:56 PM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: undefined field text
正如我所说,服务器仍将启动,我可以看到 Solr 管理界面。我定义了我的架构如下。
<fields>
<field name="id" type="string" indexed="true" stored="true" />
<field name="phraseID" type="int" indexed="true" stored="true" />
<field name="translation" type="string" indexed="true" stored="true" />
</fields>
<uniqueKey>id</uniqueKey>
我还能够执行 JSON 更新 - 我提交了一个被接受的样本数据数组。到目前为止,一切都很好。
当我尝试运行查询时:
http://localhost:8983/solr/select/?q=*:*&version=2.2&start=0&rows=10&indent=on
它正确返回了我之前在示例中提交的所有数据。
但是,当我尝试使用文本进行查询时,我收到了 HTTP 错误 404。
http://localhost:8983/solr/select/?q=fruit&version=2.2&start=0&rows=10&indent=on
--- returns ---
HTTP ERROR 400
Problem accessing /solr/select/. Reason:
undefined field text
Powered by Jetty://
最佳答案
默认 solr 配置定义了一些请求处理程序,其默认值与包含在 solr tarball 中的默认架构相匹配。
检查 solrconfig 中定义的请求处理程序,您可能会发现<str name="qf">
和其他配置值包括您尚未在架构中定义的一些字段。
此外,检查您的 schema.xml,默认搜索字段未设置为 正文 像这样:<defaultSearchField>text</defaultSearchField>
关于Solr 查询 - HTTP 错误 404 未定义字段文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10130163/