Solr 如何查询包含逗号分隔列表的字段?

Solr how to query a field containing a comma separated list?

在我们的 solr 核心中,我们有一个这样的字段:

doc1: "theTopics_stringS":"2,4,143"
doc2: "theTopics_stringS":"34,11,56,73"

我无法弄清楚如何构建一个行为类似的查询:

theTopics_stringS:(IN 2 35 23 66)

所以我想要所有 theTopics_stringS 值

中包含 2、35、23 或 66 的文档

我有哪些可能的选择?

版本:

solr-spec 7.6.0

要么在索引时拆分内容;要么即,将其索引为多值字段 - [2, 4, 13],或使用将其拆分为适当标记的分词器。标准标记器应该适用于您拥有的格式,其中 , 用作分隔符。默认的 text_en 字段可能可以正常工作。

然后,您可以使用 theTopics_ints:(2 35 23 66) 作为查询,以获取该列表中包含 2、35、23 或 66 的任何文档(给定 q.op=OR)。