为什么 Solr 在指定这些参数时首先返回“最旧”的记录。
您可能知道这些主要用于“分页”目的。
如果我选择每页 10 行,并且起始设置为 0,这意味着在我看来应该显示最新的 10 条记录。但是,Solr 显示最旧的 10 条记录。
如何更改此设置?
谢谢
最佳答案
Solr 不是数据库,而是搜索引擎。
获取行的顺序不是基于它们的插入顺序,而是基于特定的排名算法。
您可以在此处找到更多信息:
Why are search results returned in the order they are? If no other sort order is specified, the default is by relevancy score.
和
您可以指定排序顺序:使用排序参数:
示例,来自 Solr Tutorial :
Solr provides a simple method to sort on one or more indexed fields. Use the 'sort' parameter to specify "field direction" pairs...
q=video&sort=price desc
q=video&sort=price asc
q=video&sort=inStock asc, price desc
关于java - Solr 返回 'oldest' 条记录而不是 'newest' ; 'Rows' 和 'Start' 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2361886/