From 2e4ea92f7090bbd9c8db015e91548d69edfd470a Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Sat, 1 Sep 2012 10:21:51 -0400 Subject: [PATCH] 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 Signed-off-by: Lebbeous Fogle-Weekley --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index cfe8853..e66fee2 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -63,6 +63,7 @@ sub _prepare_biblio_search { my ($cgi, $ctx) = @_; my $query = _prepare_biblio_search_basics($cgi) || ''; + $query = "($query)"; $query .= ' ' . $ctx->{global_search_filter} if $ctx->{global_search_filter}; -- 1.7.2.5