简体   繁体   English

Apache Lucene 6.2 StandardAnalyzer版本

[英]Apache Lucene 6.2 StandardAnalyzer version

I'm new to Apache Lucene. 我是Apache Lucene的新手。 I'm using currently the latest version: 6.2.1 我正在使用当前最新版本:6.2.1

Based on their official documentation : http://lucene.apache.org/core/6_2_1/core/org/apache/lucene/analysis/package-summary.html 根据他们的官方文档: http : //lucene.apache.org/core/6_2_1/core/org/apache/lucene/analysis/package-summary.html

 Version matchVersion = Version.LUCENE_6_2_1;
 Analyzer analyzer = new StandardAnalyzer(matchVersion);

doesn't work. 不起作用。 It tells me there is no StandardAnalyzer constructor that receives a Version parameter; 它告诉我没有StandardAnalyzer构造函数接收Version参数。

I did something like this 我做了这样的事情

 Version matchVersion = Version.LUCENE_6_2_1;
 Analyzer analyzer = new StandardAnalyzer();
 analyzer.setVersion(matchVersion);

Is this the correct way to do and the documentation is older? 这是正确的方法并且文档比较旧吗? Or I need to add some more extra libraries besides lucene-core? 还是我需要添加除lucene-core之外的其他一些库?

Yes, the Version argument was removed in version 5.0. 是的, Version参数在版本5.0中已删除。 Setting it using setVersion would be correct. 使用setVersion设置它是正确的。 However, it should be noted that setting the version won't actually do anything. 但是,应该注意的是,设置版本实际上不会做任何事情。 StandardAnalyzer doesn't use it. StandardAnalyzer不使用它。

If you want to use the old StandardAnalyzer logic (used in version 3.1 and before), you should use ClassicAnalyzer instead. 如果要使用旧的StandardAnalyzer逻辑(在3.1版及更高版本中使用),则应改用ClassicAnalyzer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM