Bug 27010 - Warnings produced by Elasticsearch QueryBuilder.pm
Summary: Warnings produced by Elasticsearch QueryBuilder.pm
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Bugs List
QA Contact:
URL:
Keywords:
Depends on:
Blocks: 25790
  Show dependency treegraph
 
Reported: 2020-11-13 09:22 UTC by Joonas Kylmälä
Modified: 2022-05-17 11:57 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joonas Kylmälä 2020-11-13 09:22:05 UTC
In Koha/SearchEngine/Elasticsearch/QueryBuilder.pm we get following warnings:

> [WARN] Use of uninitialized value $f in hash element at /usr/share/koha/lib/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm line 605.
> [WARN] Use of uninitialized value $d in hash element at /usr/share/koha/lib/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm line 605.

This seems to be due to _convert_sort_fields() not checking whether my ( $f, $d ) get initialized by the regex before using them in the map function:

> 601     grep { $_->{field} } map {
> 602         my ( $f, $d ) = /(.+)_(.+)/;
> 603         {
> 604             field     => $sort_field_convert{$f},
> 605             direction => $sort_order_convert{$d}
> 606         }
Comment 1 Jonathan Druart 2020-12-01 14:03:13 UTC
From where do you get this warning?