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>
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);
** 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)