0

Given the search terms x,y,z, I want to construct a search query that returns

x AND (y OR z)

i.e. documents that do contain x and at least one of y and z (or both y and z). Now according to the documentation, I can use the following query

q=x&hq=y+OR+z

Now I am wondering if this returns what I want or rather

(x AND y) OR z

I found no way to test that. Any hint (also on how to test it) is very appreciated!

migrated from stackoverflow.com Dec 6 '16 at 11:01

This question came from our site for professional and enthusiast programmers.

1
+50

Short answer

Instead of

q=x&hq=y+OR+z

try

q=y+OR+z&hq=x

Explanation

  • q It's required.

    The search expression.

  • hq

    Appends the specified query terms to the query, as if they were combined with a logical AND operator.

  • Thanks for looking at the question. The problem is, I may have to query terms like "(x OR y) AND (z OR a)" so I still need to know how the parentheses are set. – Karsten W. Dec 7 '16 at 9:05
  • Even your answer did not really help, I award the bounty to you. – Karsten W. Dec 13 '16 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.