Currently sorting options are hardcoded, some of the options are not defined as sortable in the default ES mappings leading to search errors
Created attachment 68241 [details] [review] Bug 19481 - Set default sort options as sortable in ES default mappings To test: 1 - Setup Koha with ES 2 - perform a search 3 - try sorting by pubdate, acqdate, popularity, or title 4 - Search fails! 5 - Apply patch 6 - visit: /cgi-bin/koha/admin/searchengine/elasticsearch/mappings.pl?op=reset&i_know_what_i_am_doing=1 7 - Re-index ES 8 - Perform search 9 - All sorting options should work
For UNIMARC, mapping for sorting by popularity is not really defined. We could use 942$0 like in MARC21.
Created attachment 68788 [details] [review] Bug 19481 - Set default sort options as sortable in ES default mappings To test: 1 - Setup Koha with ES 2 - perform a search 3 - try sorting by pubdate, acqdate, popularity, or title 4 - Search fails! 5 - Apply patch 6 - visit: /cgi-bin/koha/admin/searchengine/elasticsearch/mappings.pl?op=reset&i_know_what_i_am_doing=1 7 - Re-index ES 8 - Perform search 9 - All sorting options should work Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Test worked as planned, however sorting by title and author seemed strange. I assume the issue wasn't introduced by this bug, but looking at the results list, it did not seem alphabetical to me.
(In reply to David Bourgault from comment #4) > Test worked as planned, however sorting by title and author seemed strange. > I assume the issue wasn't introduced by this bug, but looking at the results > list, it did not seem alphabetical to me. See bug 19581 and bug 18827 for ordering issues
Patch works as described (except for popularity when in UNIMARC, since the field is not defined). But I wonder about 6th step in test plan. Shouldn't it be done in an updatedatabase script ?
(In reply to Julian Maurice from comment #6) > Patch works as described (except for popularity when in UNIMARC, since the > field is not defined). > But I wonder about 6th step in test plan. Shouldn't it be done in an > updatedatabase script ? I am not sure - if someone has custom mappings setup for some reasonn I don't think we want to alter them. I think i would prefer to follow up on 19542 and add a warning if standard sort fields are not defined. Does that sound reasonable?
(In reply to Nick Clemens from comment #7) > I am not sure - if someone has custom mappings setup for some reasonn I > don't think we want to alter them. > > I think i would prefer to follow up on 19542 and add a warning if standard > sort fields are not defined. Does that sound reasonable? Ok
Created attachment 69224 [details] [review] Bug 19481 - Set default sort options as sortable in ES default mappings To test: 1 - Setup Koha with ES 2 - perform a search 3 - try sorting by pubdate, acqdate, popularity, or title 4 - Search fails! 5 - Apply patch 6 - visit: /cgi-bin/koha/admin/searchengine/elasticsearch/mappings.pl?op=reset&i_know_what_i_am_doing=1 7 - Re-index ES 8 - Perform search 9 - All sorting options should work Signed-off-by: David Bourgault <david.bourgault@inlibro.com> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Pushed to master for 17.11, thanks to everybody involved!