From 3fa270582a1d6a11604092da8fcb3883a756d829 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 23 Aug 2017 11:54:32 -0400 Subject: [PATCH] LP#1694577: tweak searching for words in report templates Use \m to recognize beginning-of-word boundaries; this fixes an issue where you couldn't use "clone" to retrieve templates whose name was of the form "foo (clone)". Signed-off-by: Galen Charlton Signed-off-by: Jason Etheridge --- Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm | 4 ++-- docs/RELEASE_NOTES_NEXT/Reports/template-search.adoc | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm index 6d55157fa8..81964ab3e1 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm @@ -759,10 +759,10 @@ sub search_templates { if (@$fields > 1) { $subq = {'-or' => []}; for my $field (@$fields) { - push(@{$subq->{'-or'}}, {$field => {'~*' => "(^| )$part"}}); + push(@{$subq->{'-or'}}, {$field => {'~*' => "(^|\\m)$part"}}); } } else { - $subq = {$fields->[0] => {'~*' => "(^| )$part"}}; + $subq = {$fields->[0] => {'~*' => "(^|\\m)$part"}}; } push(@{$query->{where}->{'-and'}}, $subq); diff --git a/docs/RELEASE_NOTES_NEXT/Reports/template-search.adoc b/docs/RELEASE_NOTES_NEXT/Reports/template-search.adoc index 2929a795a0..09ec8a1182 100644 --- a/docs/RELEASE_NOTES_NEXT/Reports/template-search.adoc +++ b/docs/RELEASE_NOTES_NEXT/Reports/template-search.adoc @@ -17,6 +17,7 @@ Examples ** stat cat ** statistical category ** categories, statistical + ** patrons (stat cat) * Searching for 'stat cat' does not match: ** stat *** both words must be present in the searched field(s) -- 2.43.2