Skip to content
Permalink
Browse files
Allow any-of simple search over subjects
Fixes #15

InSubject mints a new prefix in join and logic, but SubQuery (as inherited by
OrSubQuery) only uses the join from the first sub-op. Hence the perfix used in
logic for any other ORed InSubject sub-ops would not match the prefix used in
the join.

Fixed by always setting a prefix in the call to join() and logic() - empty
string so we don't make the SQL any more difficult to read than it already is.
  • Loading branch information
Tim Brody committed Jan 22, 2013
1 parent 8108c2f commit 80f9c5215a18fbadbb05888db672f3bcc2eff90a
Showing with 9 additions and 10 deletions.
  1. +0 −9 perl_lib/EPrints/Search/Condition/OrSubQuery.pm
  2. +9 −1 perl_lib/EPrints/Search/Condition/SubQuery.pm
@@ -27,15 +27,6 @@ use EPrints::Search::Condition::SubQuery;

use strict;

sub logic
{
my( $self, %opts ) = @_;

my @logic = map { $_->logic( %opts ) } @{$self->{sub_ops}};

return @logic ? "(".join(" OR ", @logic).")" : ();
}

1;

=head1 COPYRIGHT
@@ -46,14 +46,22 @@ sub joins
{
my( $self, %opts ) = @_;

# Stop sub_ops from using their own prefixes (InSubject)
$opts{prefix} = "" if !defined $opts{prefix};

return $self->{sub_ops}->[0]->joins( %opts );
}

sub logic
{
my( $self, %opts ) = @_;

return "(" . join(" OR ", map { $_->logic( %opts ) } @{$self->{sub_ops}} ) . ")";
# Stop sub_ops from using their own prefixes (InSubject)
$opts{prefix} = "" if !defined $opts{prefix};

my @logic = map { $_->logic( %opts ) } @{$self->{sub_ops}};

return @logic ? "(".join(" OR ", @logic).")" : ();
}

sub alias

0 comments on commit 80f9c52

Please sign in to comment.