Solr查询数组的最后一个索引

Solr to query the last index of array

查询Solr数组中的最后一个索引字段。

下面是一个产品的 solr 文档,其中 parentCatgroup_id_search 作为属性字段

<arr name="parentCatgroup_id_search">
<str>10001_14533</str>
<str>10001_14501</str>
<str>10001_14502</str>
<str>20051_15060</str>
<str>20051_15096</str>
<str>20051_15121</str>
<str>20051_15144</str>
</arr>

有什么方法可以查询所有匹配'20051_15144'的文档作为parentCatgroup_id_search的最后一个索引。

不,不built-in支持查询多值字段中的特定索引。

如果这是您的应用程序的特定要求,您应该将最后一个值作为单独的字段进行索引 - 即 parentCatgroup_id_search_last。如果您需要按索引以及 lastfirst 进行搜索,请创建第二个字段,在其中为值加上它们的索引和您需要的任何别名作为前缀 - 例如 last:20051_15144.