I was trying out the Component records feature and noticed the link when you have more component records than MaxComponentRecords is broken. I'm using Elasticsearch, if that changes anything. 1)Import the example file 1.1) Go to Tools > Stage MARC records for import 1.2) Upload the example file 1.3) In the form, choose the format 'MARCXML' 1.4) Click 'Stage for import' 1.5) Click 'Manage staged records' 1.6) Click 'Import this batch into the catalog' 2) Change MaxComponentRecords to 10 3) In the staff interface, search the catalog for 'easy piano' 4) Click on the record 'Easy piano pieces for children' 5) Click on the 'show all component parts' link at the bottom of the Components tab --> it searches for HASH(...) - returns no results 6) Try the same in OPAC --> it searches for HASH(...) - returns no results
Created attachment 140384 [details] Example marc file I stole the example marc file from bug 11175
Oops, I forgot to say that you have to enable the ShowComponentRecords syspref too. 1)Import the example file 1.1) Go to Tools > Stage MARC records for import 1.2) Upload the example file 1.3) In the form, choose the format 'MARCXML' 1.4) Click 'Stage for import' 1.5) Click 'Manage staged records' 1.6) Click 'Import this batch into the catalog' 2) Change ShowComponentRecords to 'both staff interface and OPAC' 3) Change MaxComponentRecords to 10 4) In the staff interface, search the catalog for 'easy piano' 5) Click on the record 'Easy piano pieces for children' 6) Click on the 'show all component parts' link at the bottom of the Components tab --> it searches for HASH(...) - returns no results 7) Try the same in OPAC --> it searches for HASH(...) - returns no results
Created attachment 142665 [details] [review] Bug 31543: Use query string, rather than query, to build link This patch returns the query string from build_query_compat Under Zebra, either works for the link, for ES we need the simple string I expand the test for get_components_query to test both engines To test: 1.0) Set search engine to Elasticsearch 1.1) Go to Tools > Stage MARC records for import 1.2) Upload the example file 1.3) In the form, choose the format 'MARCXML' 1.4) Click 'Stage for import' 1.5) Click 'Manage staged records' 1.6) Click 'Import this batch into the catalog' 2) Change MaxComponentRecords to 10 3) In the staff interface, search the catalog for 'easy piano' 4) Click on the record 'Easy piano pieces for children' 5) Click on the 'show all component parts' link at the bottom of the Components tab --> it searches for HASH(...) - returns no results 6) Try the same in OPAC --> it searches for HASH(...) - returns no results 7) Apply patch and restart all 8) repeat 3-6 9) Results returned!
This works on the staff interface, but I get no results for the OPAC. This is related to the query in the URL I think. OPAC: - Query in URL generated on the OPAC: /cgi-bin/koha/opac-search.pl?q=Host-item%3A("Easy piano pieces for children \%2F")%26sort_by%3Dtitle_asc - Search box: Host-item:("Easy piano pieces for children \/")&sort_by=title_asc - Note - the staff interface has this in the search box: Host-item:("Easy piano pieces for children \/") If I change the query in the OPAC URL to the match that used in the staff interface, it works: - Change OPAC URL to: /cgi-bin/koha/opac-search.pl?q=Host-item:("Easy piano pieces for children \/")&sort_by=title_asc - OPAC search box: Host-item:("Easy piano pieces for children \/")
Created attachment 143948 [details] [review] Bug 31543: (follow-up) Use url filter for opac components search The previous patch switches to using 'query_string' which is returned encoded. Using uri we doulbe encode the string - this patch prevents that
Created attachment 143963 [details] [review] Bug 31543: Use query string, rather than query, to build link This patch returns the query string from build_query_compat Under Zebra, either works for the link, for ES we need the simple string I expand the test for get_components_query to test both engines To test: 1.0) Set search engine to Elasticsearch 1.1) Go to Tools > Stage MARC records for import 1.2) Upload the example file 1.3) In the form, choose the format 'MARCXML' 1.4) Click 'Stage for import' 1.5) Click 'Manage staged records' 1.6) Click 'Import this batch into the catalog' 2) Change MaxComponentRecords to 10 3) In the staff interface, search the catalog for 'easy piano' 4) Click on the record 'Easy piano pieces for children' 5) Click on the 'show all component parts' link at the bottom of the Components tab --> it searches for HASH(...) - returns no results 6) Try the same in OPAC --> it searches for HASH(...) - returns no results 7) Apply patch and restart all 8) repeat 3-6 9) Results returned! Signed-off-by: David Nind <david@davidnind.com>
Created attachment 143964 [details] [review] Bug 31543: (follow-up) Use url filter for opac components search The previous patch switches to using 'query_string' which is returned encoded. Using uri we doulbe encode the string - this patch prevents that Signed-off-by: David Nind <david@davidnind.com>
Created attachment 143965 [details] [review] Bug 31543: Use query string, rather than query, to build link This patch returns the query string from build_query_compat Under Zebra, either works for the link, for ES we need the simple string I expand the test for get_components_query to test both engines To test: 1.0) Set search engine to Elasticsearch 1.1) Go to Tools > Stage MARC records for import 1.2) Upload the example file 1.3) In the form, choose the format 'MARCXML' 1.4) Click 'Stage for import' 1.5) Click 'Manage staged records' 1.6) Click 'Import this batch into the catalog' 2) Change MaxComponentRecords to 10 3) In the staff interface, search the catalog for 'easy piano' 4) Click on the record 'Easy piano pieces for children' 5) Click on the 'show all component parts' link at the bottom of the Components tab --> it searches for HASH(...) - returns no results 6) Try the same in OPAC --> it searches for HASH(...) - returns no results 7) Apply patch and restart all 8) repeat 3-6 9) Results returned! Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 143966 [details] [review] Bug 31543: (follow-up) Use url filter for opac components search The previous patch switches to using 'query_string' which is returned encoded. Using uri we doulbe encode the string - this patch prevents that Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to master for 22.11. Nice work everyone, thanks!