'SOLR Exact Match with Numerics and "OR"

I have a field in SOLR (Completion_FY__TYPE_LIST) that I'm trying to perform an exact "OR" match on but as soon as I put a second value in it does a partial match.

Completion_FY__TYPE_LIST: 2020 | Returns all records exactly matching Year "2020".

Completion_FY__TYPE_LIST: 2020 or 2022 | Returns ANY record with "20", "22" or "02" in the Year.

If I'm understanding correctly: it should only be returning records with a year of 2020 or 2022.

Other formats I've tried:

Completion_FY__TYPE_LIST:(2020 or 2022) | Invalid syntax.

Completion_FY__TYPE_LIST:(2020) or (2022) | Returns partial match years.

Completion_FY__TYPE_LIST:"2020" or "2022" | Returns partial match years.

Completion_FY__TYPE_LIST: 2020 or Completion_FY__TYPE_LIST: 2022 | Returns partial match years.



Solution 1:[1]

Completion_FY__TYPE_LIST:("2020" "2022") seems to be the fix.

Dev note: If you do not surround each of the params in double-quotes you will end up with funky data result sets Also if you try to do this with fields that have spaces in the names without them you'll also get funky data sets.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1