[open-ils-commits] [GIT] Evergreen ILS branch rel_2_8 updated. c45e4fbbcbada1592324201ebe84d0b6f0a8cda9
Evergreen Git
git at git.evergreen-ils.org
Fri Apr 1 16:33:53 EDT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_8 has been updated
via c45e4fbbcbada1592324201ebe84d0b6f0a8cda9 (commit)
from 3ea367dba2b7a2ddada5fa4fe37cdc7a94924874 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c45e4fbbcbada1592324201ebe84d0b6f0a8cda9
Author: Mike Rylander <mrylander at gmail.com>
Date: Tue Mar 22 11:50:58 2016 -0400
LP#1373601: Consider relevant characters before using word-boundary checks
To perform unanchored phrase limits, we make sure that the phrase supplied
by the user does not end in the middle of a word by bounding the condition
with word-boundary bracket expresssions. However, if the phrase starts
or ends with a non-word character (that is, something other than numbers,
letters, or the underscore) then the word-boundary expression won't match.
The effect of this is to cause phrase searches starting or ending in
punctuation to fail when the user would not expect them to.
To address this, we now test the phrase for word-iness at the front and
back before applying word-boundary bracket expressions.
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Kathy Lussier <klussier at masslnc.org>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
index f08b1e5..ea55769 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm
@@ -85,15 +85,24 @@ sub quote_phrase_value {
my $left_anchored = '';
my $right_anchored = '';
+ my $left_wb = 0;
+ my $right_wb = 0;
+
$left_anchored = $1 if $value =~ m/^([*\^])/;
$right_anchored = $1 if $value =~ m/([*\$])$/;
+
+ # We can't use word-boundary bracket expressions if the relevant char
+ # is not actually a "word" characters.
+ $left_wb = $wb if $value =~ m/^\w+/;
+ $right_wb = $wb if $value =~ m/\w+$/;
+
$value =~ s/^[*\^]// if $left_anchored;
$value =~ s/[*\$]$// if $right_anchored;
$value = quotemeta($value);
$value = '^' . $value if $left_anchored eq '^';
$value = "$value\$" if $right_anchored eq '$';
- $value = '[[:<:]]' . $value if $wb && !$left_anchored;
- $value .= '[[:>:]]' if $wb && !$right_anchored;
+ $value = '[[:<:]]' . $value if $left_wb && !$left_anchored;
+ $value .= '[[:>:]]' if $right_wb && !$right_anchored;
return $self->quote_value($value);
}
-----------------------------------------------------------------------
Summary of changes:
.../Application/Storage/Driver/Pg/QueryParser.pm | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list