Lucene.net 2.9.2 NumericField排序

发布于 2024-09-03 15:25:02 字数 78 浏览 2 评论 0原文

谁能验证最新的 Lucene.net 2.9.2 是否可以对 NumericField 进行排序(和反向排序)?我有点困惑,特别是反向排序:(

Can anyone verify if the latest Lucene.net 2.9.2 can sort (and reverse sort) NumericField? I am sort of stumped, expecially with the reverse sort :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╰ゝ天使的微笑 2024-09-10 15:25:02

我今天也遇到了同样的问题,经过一段时间的故障排除后,下面的代码可以正常工作。

TopDocs matches = searcher.Search(query, null, 10, new Sort(new SortField("id", SortField.INT, true)));

SortField.INT 很重要,否则整数字段中的排序将不起作用。

I also get into the same problem today, the below code is working after troubleshooting for some time.

TopDocs matches = searcher.Search(query, null, 10, new Sort(new SortField("id", SortField.INT, true)));

This is important SortField.INT, otherwise the sorting in the integer field is not working.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文