]> git.koha-community.org Git - koha.git/commit
Bug 22801: Advance search yr must use date-of-publication and not copydate
authorFridolin Somers <fridolin.somers@biblibre.com>
Fri, 22 Jan 2021 08:39:33 +0000 (09:39 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 3 Aug 2021 01:44:34 +0000 (15:44 -1000)
commit2cdf04463ca389815c23bea94ce4c84f9e4ca3b6
tree685e1585497e1fec589e9a0d93d43b16be462fa4
parentb2f35c2f0a7f41577112dbb9302d87485d0c1c45
Bug 22801: Advance search yr must use date-of-publication and not copydate

In advanced search with Elasticsearch the limit on years range is actually using copydate :

Koha/SearchEngine/Elasticsearch/QueryBuilder.pm in _fix_limit_special_cases() :
        if ( $l =~ /^yr,st-numeric,ge=/ ) {
            my ( $start, $end ) =
              ( $l =~ /^yr,st-numeric,ge=(.*) and yr,st-numeric,le=(.*)$/ );
            next unless defined($start) && defined($end);
            push @new_lim, "copydate:[$start TO $end]";
        }

With Zebra it uses date-of-publication and also in Koha/SearchEngine/Elasticsearch/QueryBuilder.pm :

our %index_field_convert = (
(...)
    'yr' => 'date-of-publication',

This patch uses %index_field_convert to perform 'yr' limit.

Test plan:
1) Apply patch
2) Use Elasticsearch searchengine
3) Go to advanced search with 'More options'
4) Perform a search with a year limit (value or range)
5) Check results are correct

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 7ab5837808b447275e8b1119da4806b00d1edcb6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/SearchEngine/Elasticsearch/QueryBuilder.pm