在Java方法中找不到Lucene [英] Lucene in java method not found

查看:163
本文介绍了在Java方法中找不到Lucene的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用下面的代码进行搜索,但是某些方法显示错误;

I am using those code below for searching but some methods shows error;

FSDirectory.open(new File(indexDirectoryPath));
  writer = new IndexWriter(indexDirectory, 
     new StandardAnalyzer(),true,
     IndexWriter.MaxFieldLength.UNLIMITED);

在此代码中打开,MaxFieldLength显示错误.我正在使用Lucene 6.0.0.

In this code open and MaxFieldLength shows error. I am using lucene 6.0.0.

open()方法显示错误

The open() method shows the error

FSDirectory类型的open(Path)方法不适用于 参数(文件)

The method open(Path) in the type FSDirectory is not applicable for the arguments (File)

和MaxFieldLength显示:

and MaxFieldLength shows:

MaxFieldLength无法解析或不是字段

MaxFieldLength cannot be resolved or is not a field

我使用了此处提供的代码:

I used the code provided here:

http://www.tutorialspoint.com/lucene/lucene_first_application.htm

推荐答案

可能该代码是针对较旧版本的lucene编写的. 较新的版本已将旧的Java io切换为Java Nio. 因此,您将使用以下内容:FSDirectory.open(FileSystems.getDefault().getPath("yourPath", "index")

Probably the code is written against an older version of lucene. Newer versions have switched form the old java io to the java nio. So you would use something like this:FSDirectory.open(FileSystems.getDefault().getPath("yourPath", "index")

在6.0版中,IndexWriter尚没有名为MaxFieldLength的成员.请参阅 Lucene IndexWriter API .

In version 6.0 the IndexWriter hasn't got a member called MaxFieldLength Please see Lucene IndexWriter API.

更多帮助可以在迁移指南

您可能也不会查找迁移指南的旧版本.

You may wan't to look up older versions of the migration guides as well.

这篇关于在Java方法中找不到Lucene的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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