From: Bill Erickson Date: Wed, 29 Oct 2014 21:06:49 +0000 (-0400) Subject: kmain-384_matches_exactly_dollar_sign X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7a6af3f811280c89aa043715874c46d4b536e96a;p=working%2FEvergreen.git kmain-384_matches_exactly_dollar_sign Cross-port: b82547b --- 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 2978fff5ce..f62f06e0cb 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -42,6 +42,8 @@ sub _prepare_biblio_search_basics { $jtitle = 1; } + $logger->debug("kmain384 query before: " . $query); + # This stuff probably will need refined or rethought to better handle # the weird things Real Users will surely type in. $contains = "" unless defined $contains; # silence warning @@ -53,11 +55,26 @@ sub _prepare_biblio_search_basics { $query =~ s/"//g; $query = ('"' . $query . '"') if index $query, ' '; } elsif ($contains eq 'exact') { - $query =~ s/[\^\$]//g; + $query =~ s/"//g; + + # This allows searches that end with $ or start with ^ + if ($query =~ m/^\^/ && $query =~ m/\$$/ ){ + + $query =~ s/^\^//g; + $query =~ s/\$$//g; + } + + $query =~ s/\^/\^/g; + $query =~ s/\$/\$/g; + #$query = '$VERY_UNIQUE_STRING$' . $query . '$VERY_UNIQUE_STRING$'; $query = '^' . $query . '$'; } elsif ($contains eq 'starts') { $query =~ s/"//g; - $query =~ s/[\^\$]//g; + $query =~ s/^\^//g; + $query =~ s/\$$//g; + $query =~ s/\^/\^/g; + $query =~ s/\$/\$/g; + #$query = '$VERY_UNIQUE_STRING$' . $query . '$VERY_UNIQUE_STRING$'; $query = '^' . $query; $query = ('"' . $query . '"') if index $query, ' '; } @@ -69,6 +86,8 @@ sub _prepare_biblio_search_basics { $query = "$qtype:$query" unless $qtype eq 'keyword' and $i == 0; + $logger->debug("kmain384 query after: " . $query); + $bool = ($bool and $bool eq 'or') ? '||' : '&&'; $full_query = $full_query ? "($full_query $bool $query)" : $query; }