gpt4 book ai didi

java - 如何解决 NoSuchMethodError :EdgeNGramTokenFilter

转载 作者:行者123 更新时间:2023-12-01 13:51:03 25 4
gpt4 key购买 nike

现在我的 schma.xml 配置是:

<fieldType name="text_exact_fuzzy" class="solr.TextField" omitNorms="false">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="7"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="7"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>

但是现在当我向 solr 添加数据时遇到这样的问题, 我使用 solr.StandardTokenizerFactory 定义了 fieldType 的分析器,没有任何问题,但是当使用 solr.EdgeNGramFilterFactory 的分析器可以得到这样的错误时。 我导入了 lucene-analyzers-common-4.5.0.jar、lucene-analyzers-3.5.0.jar 等 jar。 我认为 lucene-analyzers-common-4.5.0.jar 已包含 EdgeNGramFilterFactory 类。

java.lang.NoSuchMethodError: org.apache.lucene.analysis.ngram.EdgeNGramTokenFilter.<init>(Lorg/apache/lucene/util/Version;Lorg/apache/lucene/analysis/TokenStream;Ljava/lang/String;II)V
at org.apache.lucene.analysis.ngram.EdgeNGramFilterFactory.create(EdgeNGramFilterFactory.java:52)
at org.apache.lucene.analysis.ngram.EdgeNGramFilterFactory.create(EdgeNGramFilterFactory.java:34)
at org.apache.solr.analysis.TokenizerChain.createComponents(TokenizerChain.java:67)
at org.apache.lucene.analysis.AnalyzerWrapper.createComponents(AnalyzerWrapper.java:102)
at org.apache.lucene.analysis.Analyzer.tokenStream(Analyzer.java:180)
at org.apache.lucene.document.Field.tokenStream(Field.java:552)
at org.apache.lucene.index.DocInverterPerField.processFields(DocInverterPerField.java:95)
at org.apache.lucene.index.DocFieldProcessor.processDocument(DocFieldProcessor.java:248)
at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:254)
at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:446)
at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1521)
at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:217)
at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:69)
at org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51)
at org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:556)
at org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:692)
at org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:435)
at org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:100)
at org.apache.solr.handler.loader.XMLLoader.processUpdate(XMLLoader.java:247)
at org.apache.solr.handler.loader.XMLLoader.load(XMLLoader.java:174)
at org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:92)
at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1859)
at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:150)
at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:68)
at org.apache.solr.client.solrj.SolrServer.addBeans(SolrServer.java:93)
at org.apache.solr.client.solrj.SolrServer.addBeans(SolrServer.java:77)

Please help me, thanks a lot!

最佳答案

需要添加 apache-lucene-analyzers.jar ,可以从 here 下载

关于java - 如何解决 NoSuchMethodError :EdgeNGramTokenFilter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19948433/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com