使用最新版本的Lucene的示例 [英] Examples for using latest version of Lucene

查看:47
本文介绍了使用最新版本的Lucene的示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Lucene的新手,想在Maven环境中直接从Java代码中调用它.我已经尝试了一段时间以找到可以下载并运行的工作示例.官方站点上的最新教程是2013年-Lucene 3. * https://cwiki.apache.org/confluence/display/lucene/LuceneFAQ#LuceneFAQ-HowdoIstartusingLucene ?.Maven当前的最新版本是 8.5.1 .网络上的大多数非官方教程都不包含版本号或全限定名.Lucene似乎经常更改其API,语法和名称,以便发生编译错误,ClassNotFound和已删除的方法.我想知道:

I'm new to Lucene and want to call it directly from my Java code in a Maven environment. I have tried for some time to find working examples that I can download and run. The latest tutorial on the official site is 2013 - Lucene 3.* https://cwiki.apache.org/confluence/display/lucene/LuceneFAQ#LuceneFAQ-HowdoIstartusingLucene?. The current latest version in Maven is 8.5.1 . Most non-official tutorials on the web do not contain version numbers or Fully Qualified Names. Lucene appears to change its API, syntax, and names at frequent intervals so that compile errors, ClassNotFound, and deleted methods occur. I'd like to know:

  • 当前稳定版本
  • 涉及的Lucene软件包(是否需要 lucene-query 软件包?"
  • 指向这些版本的2020年代码的指针

推荐答案

文档最新版本的主页是此处.这包括所有javadoc部分的链接(不同库的不同部分).

The home page for the latest version of the documentation is here. This includes links to all the javadoc sections (different sections for different libraries).

它还包含指向一些当前工作代码示例的链接(是的,从8之前的版本到8+都有重大更改).如您所见,Wiki在这方面可能不可靠.

It also includes links to some current working code examples (yes, there are breaking changes from pre-8 to 8+). The wiki can be unreliable in this regard, as you have seen.

主要演示可能是开始的最佳位置请参阅工作代码示例.

The main demo is probably the best place to start to see working code examples.

具体来说,请参见如何编制索引

Specifically, see the how to index and how to search examples.

所需的软件包完全取决于您要执行的操作.例如,除非您知道自己需要它.

Which packages you need depends entirely on what you are trying to do. It's unlikely that you will need the spatial analysis package, for example, unless you know you need it.

我的POM通常包括以下内容:

My POM typically includes these:

<properties>
    <lucene.version>8.5.0</lucene.version>
</properties>

<dependencies>
    <dependency>        
        <groupId>org.apache.lucene</groupId>          
        <artifactId>lucene-core</artifactId>
        <version>${lucene.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-queryparser</artifactId>
        <version>${lucene.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-analyzers-common</artifactId>
        <version>${lucene.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.lucene</groupId>
        <artifactId>lucene-analyzers-icu</artifactId>
        <version>${lucene.version}</version>
    </dependency>
</dependencies>

有时我也使用这些:

<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-suggest</artifactId>
    <version>${lucene.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-highlighter</artifactId>
    <version>${lucene.version}</version>
</dependency>

这篇关于使用最新版本的Lucene的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆