Hi,
On Thu, Jun 19, 2008 at 9:14 AM, Henri-Damien LAURENT
<[EMAIL PROTECTED]> wrote:
> shifting left and right argument roles.
> ---
> C4/Search.pm | 7 +++----
> 1 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/C4/Search.pm b/C4/Search.pm
> index d4f0417..0851076 100644
> --- a/C4/Search.pm
> +++ b/C4/Search.pm
> @@ -1800,14 +1800,13 @@ sub NZoperatorOR{
> sub NZoperatorNOT{
> my ($leftresult, $rightresult)[EMAIL PROTECTED];
>
> - my @leftresult = split /;/, $leftresult;
> + my @rightresult = split /;/, $rightresult;
>
> # my @rightresult = split /;/,$leftresult;
> my $finalresult;
> - foreach (@leftresult) {
> - my $value=$_;
> + foreach my $value (@rightresult) {
> $value=$1 if $value=~m/(.*)-\d+$/;
> - unless ($rightresult =~ "$value-") {
> + unless ($leftresult =~ "$value-") {
> $finalresult .= "$_;";
> }
> }
> --
> 1.5.4.3
What are you expecting in a not operator? Suppose the database has
two records, with the following indexed terms:
record 1: mice, cats
record 2: mice, men
I would expect that a search of "mice not men" would turn up all
records that have "mice" but not the term "men", so that would yield a
resultset containing record 1.
Prior to this proposed patch, NZoperatorNOT would compare leftresult
and rightresult like this:
leftresult = [1, 2], rightresult = [2]
foreach testresult in leftresult # 1, 2
unless rightresult contains the testresult
add testresult to finalresult
resulting in
finalresult = [1]
Now, with your patch, it would be
foreach testresult in rightresult # just 2
unless leftresult contains the testresult # we want everything in
right but not left? - that seems wrong
add testresult to finalresult
finalresult = [] # i.e., no results
In other words, record 2 is not in the result set, which is OK, but
neither is record 1!
Also, please note the test cases for NoZebra in
t/lib/KohaTest/Search/NoZebra.pm. Do you disagree with how they
expect the 'not' operator to behave?
Regards,
Galen
--
Galen Charlton
Koha Application Developer
LibLime
[EMAIL PROTECTED]
p: 1-888-564-2457 x709
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches