Conditions to replicate this bug: 1) Preference QueryAutoTruncate activated 2) Have authorities with low authids 3) ElasticSearch, though it should also happen with Zebra. You can try it on this demo, it's on the master branch. Intranet: https://intranet.koha-community.es OPAC: https://catalog.koha-community.es/ User demo/demo The following searchs return different results: 1) Search in the catalog an:1 The QueryAutoTruncate adds * so it returns all the biblios that use authorities with authids that begin with 1, which are 81. That doesn't make sense as those authorities have nothing in common. https://intranet.koha-community.es/cgi-bin/koha/catalogue/search.pl?q=an%3A1 2) The authority with the id 1 is Mika Ninagawa, if you search her in the Authorities module, it says the authority is being used in two records, which is correct. https://intranet.koha-community.es/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&marclist=mainmainentry&and_or=and&excluding=&value=mika&authtypecode=&operator=contains&orderby=HeadingAsc 3) In the authority detail, Koha makes the same query as in point 1 so it appears it's being used in 81 records. https://intranet.koha-community.es/cgi-bin/koha/authorities/detail.pl?authid=1 I think this disparity in results can be confusing for librarians and readers, as they won't understand why Koha is recovering records that are unrelated to the author/subject...
Created attachment 151724 [details] [review] Don't add * when searching an authid Change in the function _truncate_terms so it doesn't add * when searching an authid, as it's an autonumeric id so starting with the same numbers doesn't mean they are related. To test 1 Make sure the system preference QueryAutoTruncate is turned ON 2 Search an authority with a low id (1,2...) and see that the number of records in the results page and in the detail page don't match. 3 Apply patch, restart services 4 Repeat step 2 and check that the number of records now match.
Maybe bug 32707 would fix this as well?
(In reply to Katrin Fischer from comment #2) > Maybe bug 32707 would fix this as well? Yes, it would--in a more general way, IMHO, also solving a problem of sn:1 and the like.
A more general solution would be better, so you may close this bug.
Please consider signing off bug 32707 then, it would really help to make things move forward.
> A more general solution would be better, so you may close this bug.(In reply to Adolfo Rodríguez Taboada from comment #4)