Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
基于score和fieldn值的apachesolr排序_Apache_Sorting_Search_Solr_Field - Fatal编程技术网

基于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
)来避免由于点击次数的微小变化而导致分数上的巨大差异