Query string logic


I'm having a little trouble understanding a specific Boolean logic from a query string query I'm running.

Suppose we have words a, b, and c. I get the following document counts with each query.

a: 948
b: 105
a OR b: 971
b AND NOT c: 104
a AND NOT c: 947
a OR (b AND NOT c): 971
a OR b AND NOT c: 104

So I don't understand the last one. Why is it that when I take out the parentheses around (b AND NOT c), it doesn't seem to recognize the a term at all.

Put another way, "b AND NOT c" gives me the same result as "a OR b AND NOT c" even though a is by far the most popular term and "a AND NOT c" still gives me 947 docs. I would have expected "a OR b AND NOT c" to be equivalent to "a OR (b AND NOT c)".

Never mind. I think I figured it out. The presence of AND is making b a required term without parentheses.

1 Like