use List::MoreUtils qw(uniq);
use SL::MoreCommon qw(listify);
use Data::Dumper;
+use Text::ParseWords;
my %filters = (
date => sub { DateTime->from_lxoffice($_[0]) },
if ($key =~ s/:multi//) {
my @multi;
my $orig_key = $key;
- for my $value (split / /, $value) {
+ for my $value (parse_line('\s+', 0, $value)) {
($key, $value) = _apply_all($key, $value, qr/\b:(\w+)/, { %filters, %{ $params{filters} || {} } });
($key, $value) = _apply_all($key, $value, qr/\b::(\w+)/, { %methods, %{ $params{methods} || {} } });
($key, $value) = _dispatch_custom_filters($params{class}, $with_objects, $key, $value) if $params{class};
use lib 't';
-use Test::More tests => 30;
+use Test::More tests => 31;
use Test::Deep;
use Data::Dumper;
]
],
}, 'complex :multi with custom dispatch and prefix', class => 'SL::DB::Manager::OrderItem';
+
+test {
+ 'description:substr:multi::ilike' => q|term1 "term2 and half" 'term3 and stuff'|,
+}, {
+ query => [
+ and => [
+ description => { ilike => '%term1%' },
+ description => { ilike => '%term2 and half%' },
+ description => { ilike => '%term3 and stuff%' },
+ ]
+ ]
+}, ':multi with complex tokenizing';