开发者社区> 问答> 正文

Lucene4.0 使用 Ik analyzer FF版 实现中文分词报错?报错

原本使用的是Lucene4.2 ,为是使搜索效果更好,就使用中文分词组件IK analyzer,最新ik只兼容到4.0,就更换为lucene4.0   然后报了下面的的错。求助!!!

java.lang.IllegalArgumentException: A SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene42' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath.The current classpath supports the following names: [Lucene40, Lucene3x]

at org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:104)
at org.apache.lucene.codecs.Codec.forName(Codec.java:95)
at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:299)
at org.apache.lucene.index.SegmentInfos$1.doBody(SegmentInfos.java:347)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:783)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:630)
at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:343)
at org.apache.lucene.index.DirectoryReader.indexExists(DirectoryReader.java:322)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:615)
at com.hgj.servlet.TimerIndexServlet$IndexTask.run(TimerIndexServlet.java:92)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
当前系统时间:Thu Jun 12 12:01:01 CST 2014
Lucene4.2开始索引数据库记录......
java.lang.IllegalArgumentException: A SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene42' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath.The current classpath supports the following names: [Lucene40, Lucene3x]
at org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:104)
at org.apache.lucene.codecs.Codec.forName(Codec.java:95)
at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:299)
at org.apache.lucene.index.SegmentInfos$1.doBody(SegmentInfos.java:347)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:783)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:630)
at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:343)
at org.apache.lucene.index.DirectoryReader.indexExists(DirectoryReader.java:322)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:615)
at com.hgj.servlet.TimerIndexServlet$IndexTask.index(TimerIndexServlet.java:288)
at com.hgj.servlet.TimerIndexServlet$IndexTask.run(TimerIndexServlet.java:109)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
A SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene42' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath.The current classpath supports the following names: [Lucene40, Lucene3x]

展开
收起
爱吃鱼的程序员 2020-06-20 17:13:31 455 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    坑爹的最后是项目索引目录里有4.2的索引文件!用ff_u1版本的路过,测试了下4.0及4.8的都没有问题。

    2020-06-20 17:13:47
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载