如何在Lucene 6中对IntPont或LongPoint字段进行排序 [英] How to sort IntPont or LongPoint field in Lucene 6

查看:645
本文介绍了如何在Lucene 6中对IntPont或LongPoint字段进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好:我正在从Lucene 5.1迁移到Lucene 6.我发现InPoint不支持排序,因为它的DocValuesType被冻结为NONE,并且排序需要NUMERIC.在Lucene 5.1中,我可以设置一个newmeric字段的字段类型,这样我就可以进行基于范围的搜索并对结果进行排序.我知道我可以迁移到LegacyIntField,但我想迁移到新的IntPoint.有谁知道如何索引数值以支持基于范围的查询和排序?

Hi: I am migrating to Lucene 6 from Lucene 5.1. I found out that InPoint does not support sorting as its DocValuesType is frozen to NONE and sorting requires NUMERIC. In Lucene 5.1, I could set the field type of a newmeric field so I could do range based search and sort the result. I know I can migrate to LegacyIntField but I'd like migrate to the new IntPoint instead. Does any one know how to index a numeric value to support both range based query and sorting?

谢谢!

推荐答案

您必须使用其他

并根据其进行排序

searcher.search(query, hitsPerPage, new Sort(new SortField("bid_sorter", SortField.Type.SCORE, true)))

这篇关于如何在Lucene 6中对IntPont或LongPoint字段进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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