There are no SolrCores running. Using the Solr Admin UI currently requires at least one SolrCore.
再次去查找这个问题,很快找到
http://stackoverflow.com/questions/13295208/i-unloaded-the-default-solr-collection-by-mistake-from-the-solr-admin-ui
编辑example/solr/solr.xml配置文件
可以看到已经变为
<core name="events" instanceDir="events" />
改为
<core name="collection1" instanceDir="collection1" />
保存,重启solr即可;
分析为什么出现这个问题,events collection的配置是错误的,solr初始化所有collection时跳过了events,而默认的collection1又改为了events则使用的是events目录下的配置信息了,
而这个配置信息又是错误的,所以solr admin 默认为没有 cores 的;修复过程中需要手动去修改配置文件,同事Y打呼用户体验太不友好了,不过我说Solr Admin用户体验很好啊,很早就不支持IE6了
现在又回到了上面的那个错误,org.apache.solr.common.SolrException: Error initializing QueryElevationComponent.
不能初始化,也不能添加events collection core,继续google,终于找到一篇提示的文章
https://coderwall.com/p/kwvxhq
Note that if you have enabled the QueryElevationComponent in solrconfig.xml it requires the schema to have a uniqueKey of typeStrField. It cannot be, for example, an int field.
Otherwise, you will get exception like:
java.lang.NumberFormatException: For input string: "MA147LL/A"
大意就是如果你开启了 QueryElevationComponent 功能,但是schema 的uniqueKey类型又不是 string,则报如下错误
java.lang.NumberFormatException: For input string: "MA147LL/A" 这个不就是我的日志里面的那个错误信息么, 于是编辑example/solr/events/conf/solrconfig.xml配置文件
搜索QueryElevationComponent关键字,可以看到如下,果然有这个信息
要配置启用这项组件,需要配置elevate.xml,同样是位于example/solr/events/conf/目录下
Elevated query results are configured in an external .xml file determined by the config-file argument. An elevate.xml file may look like this:
<elevate>
<query text="AAA">
<doc id="A" />
<doc id="B" />
</query>
<query text="ipod">
<doc id="A" />
<!-- you can optionally exclude documents from a query result -->
<doc id="B" exclude="true" />
</query>
</elevate>
For the above configuration, the query “AAA” would first return documents A and B, then whatever normally appears for the same query. For the query “ipod”, it would first return A, and would make sure that B is not in the result set. Note: The uniqueKey field must currently be of type string for the QueryElevationComponent to operate properly. 这就是答案了,uniquekey必须是string类型;目前我们项目中没有用到这项功能,所以可以选择注释不启用
1
<!--
2
<searchComponent name="elevator" >
3
<!-- pick a fieldType to analyze queries -->
4
<str name="queryFieldType">string</str>
5
<str name="config-file">elevate.xml</str>
6
</searchComponent>
7
-->
重启之后,没有初始化失败的错误了,再次往solr加入数据又有一个错误信息 undefined field text
1
ERROR - 2013-05-22 17:59:51.107; org.apache.solr.common.SolrException; org.apache.solr.common.SolrException: undefined field text
2
at org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1211)
3
at org.apache.solr.schema.IndexSchema$SolrQueryAnalyzer.getWrappedAnalyzer(IndexSchema.java:425)
4
at org.apache.lucene.analysis.AnalyzerWrapper.initReader(AnalyzerWrapper.java:81)
5
at org.apache.lucene.analysis.Analyzer.tokenStream(Analyzer.java:132)
google 得到结果,就是默认字段需要替换的问题,编辑 example/solr/events/conf/solrconfig.xml 检索到text内容