TopScoreDocCollector 类型中的方法创建(int,int)不适用于参数(int,boolean)

Method create (int, int) in the type TopScoreDocCollector is not capable for the arguments (int, boolean)

目前我正在使用 Apache Lucene,我在这部分遇到错误:

TopScoreDocCollector collector = TopScoreDocCollector.create(hitsPerPage, true);

它说:

"The method create (int, int) in the type TopScoreDocCollector is not capable for the arguments (int, boolean)"

这是我的完整代码,我从 HelloLucene.java 那里得到了一些修改。

我使用 Eclipse 和 Apache Lucene 8.4.0。我不知道,因为我太困惑了。谢谢。

这就是它所说的意思。 在 Apache Lucene 8.4.0 中,没有将 (int,boolean) 作为输入的创建方法。 检查您的版本的 API: http://lucene.apache.org/core/8_4_0/core/org/apache/lucene/search/TopScoreDocCollector.html