Description
Vitor Fernandes
2021-09-17 13:28:45 UTC
It looks like this is only an issue with Elasticsearch - Zebra seems to be have fine. I guess there is some automatic truncation going on here? You can test this easily with: an:3 and an,phr:3 in ktd and notice the difference in result lists. The authority detail page already uses the ,phr, so making them consistent seems like a good idea for a quick fix, but maybe we want to dig a little deeper to fully understand the difference in behavior here? Created attachment 131154 [details] [review] Bug 29048: Fix link to linked records from authority search results in OPAC Without this patch the constructed search link would give wrong results with Elasticsearch. If you searched for records linked to authority id 3 it would also turn up all other records linked to an authority where the id started with 3... This just copies the more specific link using an,phr used in the staff interface and the OPAC detail page to make things consistent To test: - Turn on Elasticsearch - Search for authorities in the OPAC - Locate a authority with a low ID in your result list - Note the number of linked records - Click on the link - It will give you more results than it said before - Verify results don't match your search - Apply patch - Try again - now it should all match up Created attachment 134946 [details] [review] Bug 29048: Fix link to linked records from authority search results in OPAC Without this patch the constructed search link would give wrong results with Elasticsearch. If you searched for records linked to authority id 3 it would also turn up all other records linked to an authority where the id started with 3... This just copies the more specific link using an,phr used in the staff interface and the OPAC detail page to make things consistent To test: - Turn on Elasticsearch - Search for authorities in the OPAC - Locate a authority with a low ID in your result list - Note the number of linked records - Click on the link - It will give you more results than it said before - Verify results don't match your search - Apply patch - Try again - now it should all match up We should always use "an:XXX" but with bug 24143 This is the behavior of Zebra. And this syntax is used in facets for example. Sorry, Frido, I forgot to save the change I had made (it was my intention to fix exactly that in the rebase). (In reply to Fridolin Somers from comment #5) > We should always use "an:XXX" but with bug 24143 I mean Bug 26608 (In reply to Katrin Fischer from comment #6) > Sorry, Frido, I forgot to save the change I had made (it was my intention to > fix exactly that in the rebase). Ah if adding phr works cool. We also need to change in staff interface then. Arf and XSLT is full of 'q=an:XXXX' I just made them 'the same', so fixing the inconsistency here. But I believe it's just a trick maybe to 'deactivate' QueryAutoTruncate? See: bug 30641 Created attachment 140642 [details] [review] Bug 29048: Fix link to linked records from authority search results in OPAC Without this patch the constructed search link would give wrong results with Elasticsearch. If you searched for records linked to authority id 3 it would also turn up all other records linked to an authority where the id started with 3... This just copies the more specific link using an,phr used in the staff interface and the OPAC detail page to make things consistent To test: - Turn on Elasticsearch - Search for authorities in the OPAC - Locate a authority with a low ID in your result list - Note the number of linked records - Click on the link - It will give you more results than it said before - Verify results don't match your search - Apply patch - Try again - now it should all match up Signed-off-by: David Nind <david@davidnind.com> I've tested and signed off (using KTD and the sample data). This on the assumption that it fixes the actual URL link in the records column (X record) on the OPAC authority search results listing page by changing it from &q=an:3 to &q=an,phr:3. Apologies if I have misunderstood what this is fixing! Testing notes ------------- 1. Both before and after patch: searching for Ritchie (authid=3) shows "1 record" in the records column in the authority search results listing page. 2. Link for '1 record' in the records column in the authority search results page BEFORE the patch is applied: http://127.0.0.1:8080/cgi-bin/koha/opac-search.pl?type=opac&op=do_search&q=an:3 3. Link for '1 record' in the records column in the authority search results page AFTER the patch is applied: http://127.0.0.1:8080/cgi-bin/koha/opac-search.pl?type=opac&op=do_search&q=an,phr:3 4. Both before and after the patch is applied: in the details page for the authority record it shows "Number of records used in: 44" 5. Both before and after the patch is applied: if I click the link in the authority search results listing page, I get 44 search results. 6. For all the above (1-5) QueryAutoTruncate was set to "automatically". 7. If QueryAutoTruncate is set to "only if * is added.", then the number of results displays as expected: 1. (I also linked the authority to another record, and this displayed as expected with 2 records.) 8. Bugs that will fix other issues: . Bug 26608 - Authorities: linked biblios is inconsistent using elasticsearch and QueryAutoTruncate . Bug 30641 - Authority detail page shows wrong number of records using the authority Created attachment 141486 [details] [review] Bug 29048: Fix link to linked records from authority search results in OPAC Without this patch the constructed search link would give wrong results with Elasticsearch. If you searched for records linked to authority id 3 it would also turn up all other records linked to an authority where the id started with 3... This just copies the more specific link using an,phr used in the staff interface and the OPAC detail page to make things consistent To test: - Turn on Elasticsearch - Search for authorities in the OPAC - Locate a authority with a low ID in your result list - Note the number of linked records - Click on the link - It will give you more results than it said before - Verify results don't match your search - Apply patch - Try again - now it should all match up Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Nice consistency improvement, trivial fix. Passing QA Pushed to master for 22.11. Nice work everyone, thanks! Backported to 22.05.x for upcoming 22.05.08 I have found this problem also affects the equivalent intranet search. I was able to fix it by changing line 61 of /usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en-GB/modules/authorities/details.tt and add the ,phr <a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&op=do_search&q=an,phr=[% authid | uri %]">[% count | html %] record(s)</a> Does this need adding to this patch? CORRECTION: My patch was wrong. Instead, we surround the authority number with " to force phrase search: Used in <a href="/cgi-bin/koha/catalogue/search.pl?type=intranet&op=do_search&q=an="[% authid | uri %]"">[% count | html %] record(s)</a> depends on 30740, not present in 21.11. Won't backport. |