简体   繁体   English

在Solr多值搜索中搜索严格值

[英]Search a strict value in a Solr multivalued search

I have indexed documents with a multivalued field. 我已使用多值字段索引文档。

I need to search for those documents with only one specific value and only this value even it is repeated. 我需要搜索那些只有一个特定值的文档,只有这个值才重复。

Example of document to found: 找到的文件示例:

<doc>
<arr name="source">
      <str>X</str>
</arr>
</doc>

Example of document NOT to be found: 无法找到的文件示例:

<doc>
<arr name="source">
      <str>X</str>
      <str>Y</str>
</arr>
</doc>

Could the search be like. 搜索可以像。 source:X and -source:"anything else"... ? 来源:X和-source:“别的什么”......? or strict search of a word?. 还是严格搜索一个单词?

Thankyou. 谢谢。

You need to work on the count of the multivalued field. 您需要处理多值字段的计数。
However, There is no function query to work on the count of the field. 但是,没有函数查询来处理字段的计数。
So you would need to either store the count of the field from the client side or probably check the AAA to add it automatically so that you can query source:X AND length=1 因此,您需要从客户端存储字段的计数,或者可能需要检查AAA以自动添加它,以便您可以查询source:X AND length=1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM