我使用Solr下载附带的默认Jetty服务器在我的Ubuntu机器上运行了一个Solr实例.每当我开始使用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
Run Code Online (Sandbox Code Playgroud)
正如我所说,服务器仍将启动,我可以看到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>
Run Code Online (Sandbox Code Playgroud)
我还能够执行JSON更新 - 我提交了一个被接受的示例数据数组.到目前为止,一切都很好.
当我尝试运行查询时:
http://localhost:8983/solr/select/?q=*:*&version=2.2&start=0&rows=10&indent=on
Run Code Online (Sandbox Code Playgroud)
它正确地返回我之前在示例中提交的所有数据.
但是,当我尝试使用文本查询时,我收到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://
Run Code Online (Sandbox Code Playgroud)
Ari*_*dam 47
我有同样的问题.如果没有<defaultSearchField>在solrconfig.xml文件中,查找/select处理程序.
你会发现这样的东西
<str name="df">text</str>
Run Code Online (Sandbox Code Playgroud)
那是罪魁祸首.df表示默认字段,默认情况下,它非常愚蠢地设置为text许多可能没有的字段.
将其删除并将其替换为您的默认搜索字段.
hov*_*nko 38
默认的solr配置定义了一些请求处理程序,其默认值与solr tarball中包含的默认架构相匹配.
检查solrconfig中定义的请求处理程序,您可能会发现它
<str name="qf">和其他配置值包括您未在架构中定义的某些字段.
另外,检查schema.xml,默认搜索字段未设置为如下文本:<defaultSearchField>text</defaultSearchField>
| 归档时间: |
|
| 查看次数: |
27486 次 |
| 最近记录: |