Lucene.net 2.9.2 NumericField排序 [英] Lucene.net 2.9.2 NumericField sort

查看:87
本文介绍了Lucene.net 2.9.2 NumericField排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能验证最新的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 :(

推荐答案

我今天也遇到了同样的问题,下面的代码在经过一段时间的故障排除后仍然有效.

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)));

这很重要SortField.INT,否则整数字段中的排序将无效.

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

这篇关于Lucene.net 2.9.2 NumericField排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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