solr - 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 的最后一个索引。
解决方案
不,没有内置支持在多值字段中查询特定索引。
如果这是您的应用程序的特定要求,您应该将最后一个值索引为单独的字段 - 即parentCatgroup_id_search_last
. 如果您需要按索引以及last
or进行搜索first
,请创建第二个字段,在其中为值加上它们的索引和您需要的任何别名作为前缀 - 例如last:20051_15144
.
推荐阅读
- python - Python 池多处理请求挂起
- here-api - 如何获取KML文件每个点的高程
- excel - 当用户编辑由 VBA 打开的其他工作簿中的工作表时,将 VBA 置于等待模式
- html - 卡片组不在列中
- ios - Apple Health 应用程序的哪些部分可通过 x-apple-health:// URL 方案获得?
- xml - How to optimize XQuery fn:count() in FLWOR (Parallelize)?
- javascript - angularjs $watch 没有在指令中触发
- node.js - 为什么需要 module.exports=router?
- azure - 对 Azure Functions(C# 脚本)所做的更改不会反映在输出中
- python - Keras 在 softmax 之前屏蔽零