Order by an expression in Solr

后端 未结 3 643
半阙折子戏
半阙折子戏 2021-01-05 13:23

In SQL you can order by an expression like:

SELECT * FROM a
ORDER BY CASE WHEN a.Category = 20 THEN 1 ELSE 0 DESC

so records who have Categ

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-05 13:34

    If you are using the dismax request handler, then you can use boost queries in a similar fashion. http://wiki.apache.org/solr/DisMaxQParserPlugin#bq_.28Boost_Query.29 Note that this doesn't function exactly like the your SQL example, but you can achieve the same results with it.

提交回复
热议问题