基于score和fieldn值的apachesolr排序
我使用了以下请求基于score和fieldn值的apachesolr排序,apache,sorting,search,solr,field,Apache,Sorting,Search,Solr,Field,我使用了以下请求 http://localhost:8983/solr/test6/select?q=*:*&sort=产品(分数、命中率)%20desc 根据ApacheSolr确定的相关性分数乘以名为hits(integers)的字段对结果进行排序 但是,我收到以下错误消息: { "responseHeader":{ "status":400, "QTime":0, "params":{ "q":"*:*", "sort":"product
http://localhost:8983/solr/test6/select?q=*:*&sort=产品(分数、命中率)%20desc
根据ApacheSolr确定的相关性分数乘以名为hits(integers)的字段对结果进行排序
但是,我收到以下错误消息:
{ "responseHeader":{
"status":400,
"QTime":0,
"params":{
"q":"*:*",
"sort":"product(score,hits) desc"}}, "error":{
"metadata":[
"error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.common.SolrException"],
"msg":"sort param could not be parsed as a query, and is not a field that exists in the index: product(score,hits)",
"code":400}}
为什么在以下情况下,排序无法正确输入函数值:
http://localhost:8983/solr/test6/select?q=*:*&排序=分数%20desc
http://localhost:8983/solr/test6/select?q=*:*&sort=点击%20desc
函数未应用时是否工作
注意:
http://localhost:8983/solr/test6/select?q=*:*&sort=product(hits,2)%20desc
在我添加product()函数的地方也会返回相同的错误消息。score值实际上不是一个字段,因此不能在sort子句中使用函数来操作它
相反,您可以通过boost
(如果您使用的是edismax)使用乘法boost来实现您想要的:&boost=hits
。您可能希望使用log(hits)
或类似的方法(例如recip
)来避免由于点击次数的微小变化而导致分数上的巨大差异