From e0759d0934b1d90e808e60b0a121eb3c80e7b3b9 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 24 Nov 2003 16:53:10 +0000 Subject: [PATCH] fixing a bug in searches with stopwords (that where not dropped). Moving "contains" as 1st choice for the search (= default one) --- C4/SearchMarc.pm | 24 +++++++++++-------- .../default/en/search.marc/search.tmpl | 2 +- .../default/fr/search.marc/search.tmpl | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/C4/SearchMarc.pm b/C4/SearchMarc.pm index 67d941ed0a..16fe9b64f8 100644 --- a/C4/SearchMarc.pm +++ b/C4/SearchMarc.pm @@ -89,11 +89,13 @@ sub catalogsearch { { foreach my $word (split(/ /, @$value[$i])) # if operator is contains, splits the words in separate requests { - push @not_tags, @$tags[$i]; - push @not_subfields, @$subfields[$i]; - push @not_and_or, "or"; # as request is negated, finds "foo" or "bar" if final request is NOT "foo" and "bar" - push @not_operator, @$operator[$i]; - push @not_value, $word; + unless (C4::Context->stopwords->{uc($word)}) { #it's NOT a stopword => use it. Otherwise, ignore + push @not_tags, @$tags[$i]; + push @not_subfields, @$subfields[$i]; + push @not_and_or, "or"; # as request is negated, finds "foo" or "bar" if final request is NOT "foo" and "bar" + push @not_operator, @$operator[$i]; + push @not_value, $word; + } } } else @@ -111,11 +113,13 @@ sub catalogsearch { { foreach my $word (split(/ /, @$value[$i])) { - push @normal_tags, @$tags[$i]; - push @normal_subfields, @$subfields[$i]; - push @normal_and_or, "and"; # assumes "foo" and "bar" if "foo bar" is entered - push @normal_operator, @$operator[$i]; - push @normal_value, $word; + unless (C4::Context->stopwords->{uc($word)}) { #it's NOT a stopword => use it. Otherwise, ignore + push @normal_tags, @$tags[$i]; + push @normal_subfields, @$subfields[$i]; + push @normal_and_or, "and"; # assumes "foo" and "bar" if "foo bar" is entered + push @normal_operator, @$operator[$i]; + push @normal_value, $word; + } } } else diff --git a/koha-tmpl/intranet-tmpl/default/en/search.marc/search.tmpl b/koha-tmpl/intranet-tmpl/default/en/search.marc/search.tmpl index df0dfc76a9..1dbbda1ac6 100644 --- a/koha-tmpl/intranet-tmpl/default/en/search.marc/search.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/search.marc/search.tmpl @@ -50,9 +50,9 @@ + - -- 2.39.5