SORT 时 NEST 搜索元数据丢失
NEST Search metadata lost when SORT
我正在尝试使用 NEST 7.3.1 对搜索查询进行排序。
没有排序,客户端正在检索结果,在 HitsMetadata 对象中有 Total 结果和 MaxScore,但是,添加以下排序条件,Total value has maximum of 1000 items, and the Score is lost.
.Query(q =>
///query stuff
.Sort(s => s.Descending(f => f.CreationDate.Suffix("keyword")))
);
即使我正在对数据进行排序,是否知道如何获得此元数据信息?
提前致谢
你必须在排序部分添加一个_score,试试这个:
.Query(q => ///query stuff .Sort(s => s.Descending(f => f.CreationDate.Suffix("keyword"))) .Sort(so => so.Field("_score", SortOrder.Descending) );
很高兴这成功了 ;)
我正在尝试使用 NEST 7.3.1 对搜索查询进行排序。 没有排序,客户端正在检索结果,在 HitsMetadata 对象中有 Total 结果和 MaxScore,但是,添加以下排序条件,Total value has maximum of 1000 items, and the Score is lost.
.Query(q =>
///query stuff
.Sort(s => s.Descending(f => f.CreationDate.Suffix("keyword")))
);
即使我正在对数据进行排序,是否知道如何获得此元数据信息?
提前致谢
你必须在排序部分添加一个_score,试试这个:
.Query(q => ///query stuff .Sort(s => s.Descending(f => f.CreationDate.Suffix("keyword"))) .Sort(so => so.Field("_score", SortOrder.Descending) );
很高兴这成功了 ;)