Solr查询,按子值排序

时间:2017-05-23 16:21:45

标签: jquery function sorting solr

我有一个嵌套结构

{
"id":"prop_53451_43851",
"ss_type":"child",
"ss_id_parent":"prop_53451",
"fts_field_hols_prices_price":905.0}
{
"id":"prop_53451_43852",
"ss_type":"child",
"ss_id_parent":"prop_53451",
"fts_field_hols_prices_price":1240.0,},
{
"id":"prop_53451_43853",
"ss_type":"child",
"ss_id_parent":"prop_53451",
"fts_field_hols_prices_price":1297.0}
{
  "id":"prop_53451",
  "ss_name": "master",
  "ss_type":"parent"
}

我有一个solr查询,返回每个父母的最低价格。 但我的主要查询不是按最高的孩子最低价格排序。 我已经读过可以按函数https://blog.griddynamics.com/how-to-sort-parent-documents-by-child-attributes-in-solr排序。

我的主要查询

select?fl=id,score,price[subquery]
&price.fl=price,score
&price.rows=1
&price.q{!term%20f=ss_id_parent%20v=$row.id}
&price.fq=ss_type:child
&price.sort=price asc
&fq=ss_type:parent

我的结果

  {
        "id":"prop_53451",
        "score":1.0,
        "price":{"numFound":5,"start":0,"docs":[
            {
              "price":905.0,
              "score":2.9103725}]
        }},
      {
        "id":"prop_53452",
        "score":1.0,
        "price":{"numFound":5,"start":0,"docs":[
            {
              "price":785.0,
              "score":2.9103725}]
        }},
      {
        "id":"prop_53453",
        "score":1.0,
        "price":{"numFound":5,"start":0,"docs":[
            {
              "price":703.0,
              "score":2.9103725}]
        }},

我认为我必须添加sort = {!parent ...

0 个答案:

没有答案