}
sub castdate {
- my ($value, $gte, $lte, $between) = @_;
+ my ($value, $gte, $lte, $between, $gt, $lt) = @_;
my $op = "=";
$op = ">=" if $gte;
$op = "<=" if $lte;
+ $op = ">" if $gt;
+ $op = "<" if $lt;
$op = "between" if $between;
# avoid transforming a date if the match value is NULL.
$term->{"__gte"} ? 1 : 0,
$term->{"__lte"} ? 1 : 0,
$term->{"__age"} ? 1 : 0,
+ $term->{"__gt"} ? 1 : 0,
+ $term->{"__lt"} ? 1 : 0,
);
}
$outer_clause->{$conj} = [] unless $outer_clause->{$conj};
foreach my $unit (@{$terms->{$class}}) {
my $special_clause;
- my ($k, $v, $fuzzy, $between, $not, $starts, $ends, $castdate, $gte, $lte, $age) =
+ my ($k, $v, $fuzzy, $between, $not, $starts, $ends, $castdate, $gte, $lte, $age, $gt, $lt) =
breakdown_term($unit);
my $term_clause;
}
} elsif (check_1d_max($v)) {
if ($castdate) {
- $v = castdate($v, $gte, $lte);
+ $v = castdate($v, $gte, $lte, 0, $gt, $lt);
} elsif ($gte or $lte) {
my $op = $gte ? '>=' : '<=';
$v = {$op => $v};
+ } elsif ($gt or $lt) {
+ my $op = $gt ? '>' : '<';
+ $v = {$op => $v};
} elsif (not ref $v and $not) {
# the old way, NOT (blah.id = $v) needs to be
# (blah.id <> $x OR blah.id IS NULL)