簡體   English   中英

Solr 按字段值排序

[英]Solr sort by field value

我嘗試按字段值對來自“apache solr”的響應進行排序。 這是我的排序功能:

sort=if(eq(custom_s_doctor_location_key, "advanced imaging center - lake ridge-landing"),1,0) desc

但我得到錯誤:

  "error":{
"metadata":[
  "error-class","org.apache.solr.common.SolrException",
  "root-error-class","org.apache.solr.common.SolrException"],
"msg":"Can't determine a Sort Order (asc or desc) in sort spec 'if(eq(custom_s_doctor_location_key, \"advanced imaging center - lake ridge-landing\"),1,0) desc', pos=35",
"code":400}})

custom_s_doctor_location_key 是數字字段嗎? 如果不是,則需要使用其他一些函數(如strdist)來比較字符串。 我會很麻煩但應該工作

您使用的是正確版本的 Solr 嗎? 似乎在 solr 6.2 http://yonik.com/solr-6-2/ 中引入了“eq”

不確定這里是否是這種情況,但是在嘗試按不存在的字段進行排序時,我遇到了完全相同的錯誤。

確保在您的schema.xml描述了custom_s_doctor_location_key (或類似*_key

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM