This issue is about using the QueryParser with MultiWordsSynonyms.
To reproduce the bug:
- Use AND as default operator
- Use a query string which exactly matches one synonym.
In short, the part of the query which handle the synonym lookup should keep a "OR" relation between the synonyms, but it is translated as a "AND".
If I parse: "guinea pig" which is a synonym of "cavy":
Using default OR, I get something correct:
"(+guinea +pig) cavy"
Note: I should probably better have ((+guinea +pic) cavy)
Using AND as default operator, I get something wrong:
+(+guinea +pig) +cavy
I was expected:
+((+guinea +pig) cavy)
The relation between "guinea pig" and "cavy" is now a AND. It should be still a OR because it is a synonym clause.
To help understanding. If now I parse "guinea pig world"
And I get the expected result:
+((+guinea +pig) cavy) +world
The relation between "guinea pig" and "cavy" is a OR as expected (it is a synonym), and the relation with "world" is AND as expected by the default operator.
Here is the additional unit test for, I hope it is pretty self-explanatory: