有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java是luceneappengine jar的完整版本还是我需要下载更多jar

我根据找到的指令here下载Lucene App Engine (LAE) jar from maven。下载了jar并将其导入到我的项目中之后,我希望下面的代码行能够正常工作,但是我得到了IndexWriterConfig的编译错误

GaeDirectory directory = new GaeDirectory();//create a default index
IndexWriterConfig config = GaeLuceneUtil.getIndexWriterConfig(LUCENE_VERSION, analyzer);//get configuration
IndexWriter w = new IndexWriter(directory, config);//get the writer
/* now use Apache Lucene like you're used to */

另外,我应该从哪里获得analyzer?Eclipse没有为它找到一个类。除了luceneappengine,我还需要进口lucene吗

该项目声称有一个源代码示例,但我无法打开该示例的源代码来查看代码。当我点击source时,它会返回到站点


共 (1) 个答案

  1. # 1 楼答案

    Do I have to import lucene in addition to luceneappengine?

    是的。您可以在https://code.google.com/p/luceneappengine/的Maven示例中看到这种依赖关系,其中对lucene核心和公共分析器的依赖关系是显式的

    The project claims there is an example with source, but I cannot open the source of the example to see the code. When I click on source it loops back to the site.

    https://code.google.com/p/lucene-appengine-examples/source/browse/src/main/java/com/googlecode/lucene/IndexServlet.java为我工作,并开始

    package com.googlecode.lucene;
    
    import com.googlecode.luceneappengine.GaeDirectory;
    import org.apache.lucene.analysis.Analyzer;
    

    (然后大量导入org.apache.lucene内容)确认,是的,luceneappenginelucene的一个附加组件,您仍然需要从后者(核心和通用分析器)导入大量内容