solr 4.3的一些错误解决方法
来源:互联网 发布:淘宝买配件组装电脑 编辑:程序博客网 时间:2024/06/03 06:43
在去年时候学习使用了solr4.0,现在solr版本最新已经到了4.3了,前两天因为工作需要在一台服务器上面新安装solr,但是生产环境是4.0,不过想到是内部测试用的,且主要功能就是写入,删除,搜索,与程序上面没有太多的深入开发,于是还是安装了最新的4.3版本
解压安装启动后,就可以了;这时需要添加collection,添加的collection配置需要与生产环境保持一致,于是复制默认的collection1 的配置信息作为新的collection
复制完成,新的collection events 也添加完成;但是加载时总是报错不能正确加载solrconfig.xml信息,也知道schema.xml等数据肯定是要修改的,schema.xml配置信息修改完成后还是有这样的问题,在往solr写入数据时又再次报错
undefined filed message,但是message字段确实已经配置好了;检查之后再次重启solr,查看刚才的events 直接显示 “There exists no core with name “events””
这时去查看日志,显示信息
正在排查中是,同事Y看到了,直接把solr 默认的collection1 改名为 events ,再次刷新直接挂了
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
关键字,可以看到如下,果然有这个信息
http://wiki.apache.org/solr/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类型;目前我们项目中没有用到这项功能,所以可以选择注释不启用
重启之后,没有初始化失败的错误了,再次往solr加入数据又有一个错误信息 undefined field text
google 得到结果,就是默认字段需要替换的问题,编辑 example/solr/events/conf/solrconfig.xml 检索到text内容
<lst name="defaults"> <str name="echoParams">explicit</str> <int name="rows">10</int> <str name="df">text</str> </lst>
因为solrconfig.xml等配置文件时从collection1复制过来的,默认的default字段匹配是text,所以目前改为我们项目所用到的字段值message 保存文件,重启solr,写入数据没有问题了,search也正常的有数据内容返回了
版本的不同,配置文件内容也会做一些变动与修改;所以可能需要修改的配置不仅仅只是与项目search有关的内容,还有版本与版本之间,新版本默认启用的模块所需的配置有关;还有一点,多看日志,多用Google!
参考:http://leil.info/archives/solr-4-3%E7%9A%84%E4%B8%80%E4%BA%9B%E9%94%99%E8%AF%AF%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/
- solr 4.3的一些错误解决方法
- SOLR的一些错误
- 一些错误的解决方法
- 使用solr遇到的一些错误记录
- MySql的一些错误解决方法
- Git 一些错误的解决方法
- Git 一些错误的解决方法
- Git 一些错误的解决方法
- Git 一些错误的解决方法
- Git 一些错误的解决方法
- Git 一些错误的解决方法
- Git 一些错误的解决方法
- 驱动开发的一些错误解决方法
- Eclipse SVN的一些错误解决方法
- 关于git的一些错误解决方法。
- 编译中常见的一些错误解决方法
- 关于android studio的一些错误解决方法- -
- 关于Tomcat一些启动错误的解决方法
- axure 7.0 注册码
- 安卓ADT和JAVA安装用户环境变量的设置
- Photoshop设计中用羽化消除边缘锯齿
- 非常棒的io流操作的小demo
- 接口详解
- solr 4.3的一些错误解决方法
- VS2010下出现LINK:fatal error LNK1123:转换到COFF期间失败;文件无效或损坏
- 学哪门编程语言赚钱最多
- slowhttptest的几种慢攻击DOS原理
- 长连接 短连接
- top域名选择要点
- Oracle数据类型之number
- 生成自己的app key文件
- JavaScript中substr和substring的区别