Solr: Sort by score & an int field value

匿名 (未验证) 提交于 2019-12-03 09:52:54

问题:

I need to sort documents returned in order of (descending) score & (descending) value of an int field within the document. How do I ensure proper sort order as well as good performance ?

I don't need the sort-order defined by sort=score desc,intField desc. The sort order needs to be somewhat like what will be delivered using product function of score*fieldVal as effective score for sort order. But I don't need exact product for sorting. Approximations are ok, & this is just to roughly define the sort order I need.

I can see a few possible ways to accomplish this:

1. Use a customized function of score for sort

2. Use query time boost to increase the score using the int field value for boost

I'm new to Solr & don't understand the performance implications of each of above case. Also, don't know if there are other better ways to accomplish what I am trying to do. So how do I build performance friendly query to achieve this sort order ?

回答1:

Have a look at solr function queries

http://wiki.apache.org/solr/FunctionQuery

Example: &sort=product(score, fieldVal)



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