I'm glad you got it working, though I would have thought you've made it more complicated than necessary.
That's what my example does. Eg using the countries in my example, the result will be 'UK', whether I search for:
country = UK (input1)
code = GBR (input2)
country = UK | code = GBR (both inputs used)