https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44063 Bug ID: 44063 Summary: Component parts are not sorted by ComponentSortField and ComponentSortOrder Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Searching Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Blocks: 34482 Target Milestone: --- Koha::Biblio->get_marc_components ignores the ComponentSortField and ComponentSortOrder preferences, so the component parts of a record (the Components tab, bugs 11175 and 30327) always come back in the search engine's default order. The cause is in Koha/Biblio.pm. get_components_query returns three values: return ( $query, $query_str, $sort ); but get_marc_components only unpacks two of them: my ( $searchstr, $sort ) = $self->get_components_query; so $sort holds the query string rather than the sort (for example title_za), and that is what is passed to search_compat. This came in with bug 30327. To test (found on a Zebra instance, not checked on Elasticsearch): 1. Set UseControlNumber to Use and ShowComponentRecords to both 2. Create a host record with a 001 and a 003, and three records linked to it: Leader position 7 'a' and a 773 $w with the host's control number, with titles that sort differently from the order they were created in 3. Set ComponentSortField to title and ComponentSortOrder to 'from Z to A' 4. Open the host record in the staff interface and look at the Components tab => The components are not sorted from Z to A. Changing ComponentSortOrder never changes the order. Calling search_compat directly with the sort 'title_za' does reverse it. The preference offers asc, dsc, az and za. Zebra understood title_az and title_za but not title_asc, so the values each search engine needs should be checked when fixing this, so that both get a sort they know. See also bug 29441 (make the returns of the Koha::Biblio get_marc_* methods consistent). Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34482 [Bug 34482] Improve MARC21 7xx linking fields in bibliographic records [Omnibus] -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.