指南针卢塞恩命中
我在上面使用 Lucene 和 Compass,遇到一个问题:
try {
CompassHits hits = compassQuery.hits();
for (CompassHit compassHit : hits) {
if (results.size() >= maxResults) {
Log.info(this, "Number of results exceeded %,d for query %s", maxResults, query);
break;
} else {
results.add((T) compassHit.getData());
}
}
}
当通过 compassHit.getData());
获取数据并且命中 100 时,它会重新执行搜索,是否有可能将其更改为 200 或更多?
编辑:
来自 wiki apache org:
“迭代所有命中很慢有两个原因。首先,当您需要超过 100 个命中时,返回 Hits 对象的 search() 方法会在内部重新执行搜索”。
我的问题是否有机会将此值“100”更改为“200”? 但重要的是我使用指南针或原始 Lucene。
I use Lucene and Compass on it and I have a problem:
try {
CompassHits hits = compassQuery.hits();
for (CompassHit compassHit : hits) {
if (results.size() >= maxResults) {
Log.info(this, "Number of results exceeded %,d for query %s", maxResults, query);
break;
} else {
results.add((T) compassHit.getData());
}
}
}
When the data is geting by compassHit.getData());
and it's a 100 hit it re-execute the search, is there any possibility to change it to 200 or more?
EDIT:
From wiki apache org:
"Iterating over all hits is slow for two reasons. Firstly, the search() method that returns a Hits object re-executes the search internally when you need more than 100 hits".
And my question is there opportunity to change this value "100" to "200"?
but important is that I use compass nor a raw Lucene.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我查看了 2.9.2 中 Hits 的来源。它是硬编码的。看起来它是硬编码的
如果您没有使用 Compass,您可以按照 JavaDoc for Hits 中的说明进行操作,该说明建议进行替换
,例如可以使用 TopDocCollector 和 TopDocs:
但是既然您使用了 Compass,除非您愿意重写部分内容指南针,我想你被困住了
I looked at the source for Hits in 2.9.2. It's hard coded. It looks like it's hard coded
If you weren't using Compass, you could follow the instructions in the JavaDoc for Hits which suggests a replacement
Instead e. g. TopDocCollector and TopDocs can be used:
But since you are, unless you are willing to rewrite part of Compass, I think you are stuck