search - Solr how to query a field containing a comma separated list?
问题描述
in our solr core we have a field like this:
doc1: "theTopics_stringS":"2,4,143"
doc2: "theTopics_stringS":"34,11,56,73"
i cannot figure out how i can construct a query that behaves like that:
theTopics_stringS:(IN 2 35 23 66)
so i would want all documents which have 2, 35, 23 or 66 in their theTopics_stringS value
what are my possible options?
version:
solr-spec 7.6.0
解决方案
在索引时拆分内容;即将它索引为多值字段 - [2, 4, 13]
,或使用将其拆分为适当标记的标记器。标准标记器应该适用于您拥有的格式,其中,
用作分隔符。默认text_en
字段可能适用于此。
然后,您可以使用theTopics_ints:(2 35 23 66)
查询来获取该列表中包含 2、35、23 或 66 的任何文档(给定q.op=OR
)。
推荐阅读
- multi-tenant - Activiti 6.0.0和postgres数据库如何实现多租户使用?
- reactjs - react-router 中的传递状态在 react 中不起作用
- c# - 没有源的 Automapper 解析器
- google-bigquery - BigQuery 标准 SQL:检查数组是否为空不起作用
- reactjs - 将 React 开发模式更改为生产模式
- angular - Angular 5 / HttpInterceptor / 检测(取消)xhr
- authentication - 使用 ACR1255U 认证 UL-C 标签
- android - 无法使用 AWS 设备场打开和关闭通知面板
- c++ - gcc Nvapi 编译错误
- reporting-services - 根据 CSV 等渲染选项运行 SSRS 数据集