首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >lucene Field.Index.ANALYZED不工作inVersion.LUCENE_40

lucene Field.Index.ANALYZED不工作inVersion.LUCENE_40
EN

Stack Overflow用户
提问于 2013-11-29 09:55:51
回答 1查看 419关注 0票数 1

我是lucene的新手,我想要索引和搜索文件名,一个url给出任何可能的答案。

我的代码如下:

代码语言:javascript
复制
IndexWriter writer = null;
Analyzer analyzer = new StandardAnalyzer();
FSDirectory dir = FSDirectory.open(index);
IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, analyzer);
writer = new IndexWriter(dir, config);
Document doc = new Document();
doc.add(new Field("file_name", rs.getString("file_name"), Field.Store.NO,Field.Index.ANALYZED));
writer.addDocument(doc);
writer.optimize();
writer.commit();
writer.close();

,但在运行时会出现异常:

代码语言:javascript
复制
Exception in thread "main" java.lang.AbstractMethodError: org.apache.lucene.analysis.TokenStream.incrementToken()Z
at org.apache.lucene.index.DocInverterPerField.processFields(DocInverterPerField.java:133)
 at org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(DocFieldProcessorPerThread.java:248)
at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:851)
at org.apache.lucene.index.DocumentsWriter.addDocument(DocumentsWriter.java:827)
at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:2022)
at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1996)
at TextIndex1.main(TextIndex1.java:63)
EN

回答 1

Stack Overflow用户

发布于 2013-12-02 04:29:59

这和Lucene无关。您有一些运行时错误。AbstractMethodError方法错误javadoc声明:

Thrown when an application tries to call an abstract method. Normally, this error is caught by the compiler; this error can only occur at run time if the definition of some class has incompatibly changed since the currently executing method was last compiled.

查看运行应用程序时使用的库。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20282922

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档