如何对Lucene 6中的IntPont或LongPoint字段进行排序
您好:我正在从Lucene 5.1迁移到Lucene 6。我发现InPoint不支持排序,因为它的DocValuesType被冻结为NONE,排序需要数字。在Lucene 5.1中,我可以设置一个newmeric字段的字段类型,这样我就可以进行基于范围的搜索并对结果进行排序。我知道我可以迁移到LegacyIntField,但我想迁移到新的IntPoint。有人知道如何为数值编制索引以支持基于范围的查询和排序吗如何对Lucene 6中的IntPont或LongPoint字段进行排序,lucene,Lucene,您好:我正在从Lucene 5.1迁移到Lucene 6。我发现InPoint不支持排序,因为它的DocValuesType被冻结为NONE,排序需要数字。在Lucene 5.1中,我可以设置一个newmeric字段的字段类型,这样我就可以进行基于范围的搜索并对结果进行排序。我知道我可以迁移到LegacyIntField,但我想迁移到新的IntPoint。有人知道如何为数值编制索引以支持基于范围的查询和排序吗 谢谢大家! 您必须使用额外的 并在此基础上进行排序 searcher.search(q
谢谢大家! 您必须使用额外的 并在此基础上进行排序
searcher.search(query, hitsPerPage, new Sort(new SortField("bid_sorter", SortField.Type.SCORE, true)))
你必须使用额外的 并在此基础上进行排序
searcher.search(query, hitsPerPage, new Sort(new SortField("bid_sorter", SortField.Type.SCORE, true)))
您需要将值存储在NumericDocValuesField或其子类中。
新增单据(新增NumericDocValuesField(字段,10));
则按此字段排序的搜索单据为:
Sort Sort=新排序(新排序)numericsortfield(字段,
SortField.Type.INT,true);
TopDocs TopDocs=indexsearcher.search(查询、返回的DocNum、排序)代码>您需要将值存储在NumericDocValuesField或其子类中。
新增单据(新增NumericDocValuesField(字段,10));
则按此字段排序的搜索单据为:
Sort Sort=新排序(新排序)numericsortfield(字段,
SortField.Type.INT,true);
TopDocs TopDocs=indexsearcher.search(查询、返回的DocNum、排序)代码>您不必使用SortedNumericSortField,SortField支持文档值您不必使用SortedNumericSortField,SortField支持文档值仅支持NumericDocValues,SortField足够NumericDocValues和SortField