How does Solr sort by default when using filter query *:*?

拈花ヽ惹草 提交于 2019-12-18 15:16:24

问题


We currently have a page setup that has no filters/facet/queries applied. It is a listing of all content (using a pager). The filter query is something like *:* (anything from any field).

I can't figure out how the content is being sorted though. It says it's by "relevancy", but what does that mean when you're selecting everything?

I did some quick testing. It does not appear to be sorted by the date the content is modified, or entered into the index.


回答1:


Querying for *:* is also called a MatchAllDocsQuery. According to the SO question How are results ordered in solr in a "match all docs" query it will return the docs in the same order as they were stored in the index.

Be aware that if you update an existing document, it get's deleted and recreated. As such it would appear at the end of such a search afterwards.

There are (at least) two threads in Lucene's Nabble I am aware of that are interesting on this topic

  • http://lucene.472066.n3.nabble.com/Result-order-when-score-is-the-same-td2816127.html
    • gets really interesting around here http://lucene.472066.n3.nabble.com/Result-order-when-score-is-the-same-tp2816127p2817766.html
  • http://lucene.472066.n3.nabble.com/Result-ordering-for-Wildcard-Prefix-queries-or-ConstantScoreQueries-td492687.html



回答2:


The default search should be by score desc if the sort parameter is not specified. : will just select everything.

Reference: http://wiki.apache.org/solr/CommonQueryParameters#q



来源:https://stackoverflow.com/questions/21236774/how-does-solr-sort-by-default-when-using-filter-query

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!