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

时间:2019-07-15 14:23:23

标签: solr websphere-commerce

查询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的最后一个索引。

1 个答案:

答案 0 :(得分:0)

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

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