如何在SOLR中按日期排序? [英] How to sort by date in SOLR?
本文介绍了如何在SOLR中按日期排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想对从 SOLR 搜索返回的结果和分数进行排序,如何根据日期获得分数,如下所示:
I want to sort the results and scores returning from SOLR search,how I can get scores based on date like below:
Suppose for keywords "football"
12-10-2012 - 3.2
13-10-2012 - 1.5
我提交的 solr 日期如下:
My solr date filed lis like below:
<field name="published_date" datetimeformat="dd-MM-yyyy" type="date" indexed="true" stored="true"/>
我检查了这个文档,但没有找到.
I checked this docs but couldn't find that.
谢谢.
推荐答案
您可以通过 排序 URL 中的参数
You can pass the sort parameter in the URL
例如sort=published_date desc
按发布日期降序排列文档.
e.g. sort=published_date desc
for documents by published date in descending order.
如果你想按分数和日期排序,你可以使用 sort=score desc,published_date desc
If you want to sort by score and date you can use sort=score desc, published_date desc
这篇关于如何在SOLR中按日期排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文