Solr 7.5 Limiting Facet with certain term cannot order by count?

Solr 7.5 Limiting Facet with certain terms can not order by count?

我想在 Solr table 作者上对 location.authorIds 字段进行分面,但也用某些术语限制分面。

我这样做了,就像在 Solr 7.5 教程中一样,http://lucene.apache.org/solr/guide/7_5/faceting.html,但是从 Solr 返回的结果没有按计数排序,有人知道为什么吗?

这是我的 Solr 查询:

http://127.0.0.1:8080/solr/authors/select?q=*:*&fl=handle&fq=search.resourcetype:2&start=0&rows=0&facet.field={!terms=27J001,J027,J132,J107,J225,J141,J092,J191,J224,J198,J062,J051,J143,J208,J119,J031,J057,J030,J134,J144,J158,J058,J181,J222,J153,J002,J203,J012,J045,J014,J186,J011,J064,J065,J147,J112,J192,J167,J066,J135,J096,J082,J075,J009,J193,J217,J168,J121,J059,J034,J213,J148,J169,J133,J013,J161,J093,J097,J162,J021,J170,J171,J083,J187,J178,J077,J194,J078,J098,J067,J047,J052,J172,J005,J113,J079,J099,J114,J100,J115,J068,J173,J084,J214,J101,J060,J025,J122,J195,J188,J196,J116,J102,J159,J197,J029,J094,J123,J053,J043,J189,J124,J015,J085,J174,J004,J044,J182,J088,J007}location.authorIds&facet=true&facet.sort=count

这是结果,您可以看到它没有按计数排序。

在我对代码进行了测试和调试之后,我可以清楚地看到,这是代码中的一个错误。

org.apache.solr.request.SimpleFacets#getListedTermCounts

for (String term : terms) {    
      int count = searcher.numDocs(ft.getFieldQuery(null, sf, term), parsed.docs);
      res.add(term, count);
}

这显然是错误的,因为它只是遍历列表并按照您在查询参数中指定的顺序提供计数。

我创建了一个 Solr 问题 - https://issues.apache.org/jira/browse/SOLR-13156 - and provided the patch. It was committed 很快就会在 Solr 中可用