ramon_salla
ramon_salla

Reputation: 1607

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"... ? or strict search of a word?.

Thankyou.

Upvotes: 0

Views: 199

Answers (1)

Jayendra
Jayendra

Reputation: 52809

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

Upvotes: 2

Related Questions