1

I have a field that is defined:

<field name="countries" type="string" indexed="true" stored="true" multiValued="true"/>

I am looking for query syntax to get from solr documents where field "countries" contains value X.

For value X the query that I am looking for should return documents where:

countries = ['X','Y',...] or countries = ['X']

I already tried tip from this thread Solr query syntax for array field

But for countries: X it returns only docs where countries = ['X'] and skips countries = ['X','Y',...]

Przemek
  • 647
  • 2
  • 8
  • 25
  • 3
    What is the _actual_ content of your field? As long as you've actually indexed it as a multivalued field, `countries:X` should work just fine. Seems like you've serialized your array as a string, and it's not actually stored as multiple values in Solr. – MatsLindh Oct 28 '20 at 13:54
  • Since you are using a string field, make sure the value of X in the array matches case and punctuation (e.g. ['Y','x'] will not match, but ['Y','X'] will match) – Hector Correa Oct 28 '20 at 14:40

0 Answers0