Bug 34740 - Sort option are wrong in search engine configuration (Elasticsearch)
Summary: Sort option are wrong in search engine configuration (Elasticsearch)
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Nick Clemens (kidclamp)
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on: 30572
Blocks:
  Show dependency treegraph
 
Reported: 2023-09-07 17:08 UTC by Nick Clemens (kidclamp)
Modified: 2024-07-04 20:40 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.04,22.11.11
Circulation function:


Attachments
Bug 34740: Update sort options in ES config to by Yes/No (3.22 KB, patch)
2023-09-07 17:18 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 34740: Update sort options in ES config to by Yes/No (3.28 KB, patch)
2023-09-11 19:13 UTC, Salah Ghedda
Details | Diff | Splinter Review
Bug 34740: Update sort options in ES config to by Yes/No (3.33 KB, patch)
2023-09-17 20:45 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2023-09-07 17:08:51 UTC
When adding a field, the sort options are 'Undef',0,1

Add a new field and leave sort at undef
Save the mappings
It breaks! Sort cannot be null

The options should be 'Yes','No' in the dropdown as values 1,0
Comment 1 Nick Clemens (kidclamp) 2023-09-07 17:18:37 UTC
Created attachment 155337 [details] [review]
Bug 34740: Update sort options in ES config to by Yes/No

At some point the option for 'undef' was removed from te sort options
and was collapsed to yes/no

The dropdowns when adding a new field were missed, this patch corrects that.

While undef in a mappings file wil stil load, when saving we should not privde undef any longer

To test:
1 - Browse to bottom to add a new field on the 'Bibliographic records' tab in
    Administration > Search engine configuration (Elasticsearch)
2 - Set sortable column to undef, set other columns and provide a valid field
3 - Click '+Add'
4 - Click 'Save'
5 - At top of page you receive an error:
 An error occurred when updating mappings: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'sort' cannot be null at /kohadevbox/koha/Koha/SearchField.pm line 37 .
6 - Apply patch, restart all
7 - Add a new mapping, your only choices are Yes/No
8 - Save mapping
9 - Confirm it saves correctly
Comment 2 Salah Ghedda 2023-09-11 19:13:31 UTC
Created attachment 155519 [details] [review]
Bug 34740: Update sort options in ES config to by Yes/No

At some point the option for 'undef' was removed from te sort options
and was collapsed to yes/no

The dropdowns when adding a new field were missed, this patch corrects that.

While undef in a mappings file wil stil load, when saving we should not privde undef any longer

To test:
1 - Browse to bottom to add a new field on the 'Bibliographic records' tab in
    Administration > Search engine configuration (Elasticsearch)
2 - Set sortable column to undef, set other columns and provide a valid field
3 - Click '+Add'
4 - Click 'Save'
5 - At top of page you receive an error:
 An error occurred when updating mappings: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'sort' cannot be null at /kohadevbox/koha/Koha/SearchField.pm line 37 .
6 - Apply patch, restart all
7 - Add a new mapping, your only choices are Yes/No
8 - Save mapping
9 - Confirm it saves correctly

Signed-off-by: Salah Ghedda <salah.ghedda@inLibro.com>
Comment 3 Katrin Fischer 2023-09-17 20:45:31 UTC
Created attachment 155764 [details] [review]
Bug 34740: Update sort options in ES config to by Yes/No

At some point the option for 'undef' was removed from te sort options
and was collapsed to yes/no

The dropdowns when adding a new field were missed, this patch corrects that.

While undef in a mappings file wil stil load, when saving we should not privde undef any longer

To test:
1 - Browse to bottom to add a new field on the 'Bibliographic records' tab in
    Administration > Search engine configuration (Elasticsearch)
2 - Set sortable column to undef, set other columns and provide a valid field
3 - Click '+Add'
4 - Click 'Save'
5 - At top of page you receive an error:
 An error occurred when updating mappings: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'sort' cannot be null at /kohadevbox/koha/Koha/SearchField.pm line 37 .
6 - Apply patch, restart all
7 - Add a new mapping, your only choices are Yes/No
8 - Save mapping
9 - Confirm it saves correctly

Signed-off-by: Salah Ghedda <salah.ghedda@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Tomás Cohen Arazi (tcohen) 2023-09-18 18:55:09 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 5 Fridolin Somers 2023-09-18 21:50:29 UTC
Indeed Bug 30572 made sort column not null default 1
Comment 6 Fridolin Somers 2023-09-18 21:51:06 UTC
Pushed to 23.05.x for 23.05.04
Comment 7 Matt Blenkinsop 2023-10-12 16:01:12 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x