首页 > 解决方案 > Solr查询数组的最后一个索引

问题描述

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

以下是一种产品的 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 的最后一个索引。

标签: solrwebsphere-commerce

解决方案


不,没有内置支持在多值字段中查询特定索引。

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


推荐阅读