azure search sort and filter by score

孤者浪人 提交于 2019-12-20 03:33:17

问题


I want to know how to filter and order the results by score with azure search.

I tried :

https://domaine.net/indexes/indexName/docs?search=TEST$orderby=@search.score%20desc&$count=true

Return :

object(stdClass)#322 (1) {
  ["error"]=>
  object(stdClass)#323 (2) {
    ["code"]=>
    string(0) ""
    ["message"]=>
    string(96) "Invalid expression: Syntax error at position 8 in '@search.score asc'.
Parameter name: $orderby"
  }
}

回答1:


Results are sorted by score (descending) by default. If you sort by other criteria, score is used to break ties. If you want to sort by score explicitly, you can use the search.score() function in the $orderby parameter. It is documented here.

It's not currently possible to filter by score. Since score varies as a function of not only the query but also the data corpus, I would be curious to understand your scenario better for filtering based on a score number.



来源:https://stackoverflow.com/questions/27359236/azure-search-sort-and-filter-by-score

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