Bug #1044721: QP handles explicit group+joiner badly user/jcamins/bug_1044721
authorJared Camins-Esakov <jcamins@cpbibliography.com>
Sat, 1 Sep 2012 14:21:51 +0000 (10:21 -0400)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Sat, 1 Sep 2012 14:26:29 +0000 (10:26 -0400)
commit86d0e76d24e34a9693e288eb64525f4afd0f161f
tree9858d1e81facfae582baea1a9d9f3b24f39715e2
parent4fb4e3df754cc0e7437276a9db72c9b0be5ddba2
Bug #1044721: QP handles explicit group+joiner badly

Although the following four queries should be equivalent:
  george  ||  fred
 (george) ||  fred
  george  || (fred)
 (george) || (fred)

The Pg QueryParser driver generates SQL queries that return different
numbers of results for each of those queries, with all desired results
appearing only with the first query. This seems to be because of the way
filters are added in the interface.

This patch adjusts the Search code in TPAC to add an explicit group
around the user-entered query, which enables the Pg QueryParser driver
to handle all four of the above queries properly.

This patch should also resolve the problems encountered with the patch
for bug #1040740, "Implicit ANDs should have higher precedence than
explicit ORs"

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm