LP#1694577: tweak searching for words in report templates
authorGalen Charlton <gmc@equinoxinitiative.org>
Wed, 23 Aug 2017 15:54:32 +0000 (11:54 -0400)
committerJason Etheridge <jason@EquinoxInitiative.org>
Wed, 23 Aug 2017 16:05:12 +0000 (12:05 -0400)
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 <gmc@equinoxinitiative.org>
Signed-off-by: Jason Etheridge <jason@EquinoxInitiative.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm
docs/RELEASE_NOTES_NEXT/Reports/template-search.adoc

index 6d55157..81964ab 100644 (file)
@@ -759,10 +759,10 @@ sub search_templates {
         if (@$fields > 1) {
             $subq = {'-or' => []};
             for my $field (@$fields) {
         if (@$fields > 1) {
             $subq = {'-or' => []};
             for my $field (@$fields) {
-                push(@{$subq->{'-or'}}, {$field => {'~*' => "(^| )$part"}});
+                push(@{$subq->{'-or'}}, {$field => {'~*' => "(^|\\m)$part"}});
             }
         } else {
             }
         } else {
-            $subq = {$fields->[0] => {'~*' => "(^| )$part"}};
+            $subq = {$fields->[0] => {'~*' => "(^|\\m)$part"}};
         }
 
         push(@{$query->{where}->{'-and'}}, $subq);
         }
 
         push(@{$query->{where}->{'-and'}}, $subq);
index 2929a79..09ec8a1 100644 (file)
@@ -17,6 +17,7 @@ Examples
   ** stat cat
   ** statistical category
   ** categories, statistical
   ** 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)
  * Searching for 'stat cat' does not match:
   ** stat 
    *** both words must be present in the searched field(s)