You can see the wrong behaviour in a clean sample database with http://localhost:8081/cgi-bin/koha/authorities/detail.pl?authid=133 To test: * Test plan assumes you are using the ktd sample data * Staff interface > authorities * Search for agile * Verfiy the result list shows used by 2 records and this is correct (authority is linked to both of them) * Switch to authority detail page * Verify it shows 3 records use this authority * Verify this is incorrect (the second record is not linked to the authority) I suspect that the detail page doesn't do an exact/phrase search opposed to the other pages, finding also records with similar authority numbers?
Ok, getting closer: The number on results and detail page match and are correct if AutoQueryTruncate is deactivated.
And Elasticsearch is used.
Cant directly reproduce this under Zebra. I am inclined to think that it is related to Elastic search engine module. Please confirm. Did you work under Elastic? Would be nice if we just used ->get_usage_count doing something like simple_search_compat( 'an:' . $authid, 0, 0 ) The other call goes (under Zebra) via SearchAuthorities.
Hi Marcel, our investigation overlapped. The key factors are: Searchengine Elasticsearch AutoQueryTruncate ON (automatic truncation)
The problematic one is get_usage_count - I found this while testing bug 20615 that uses it and shows the wrong number. Not sure what the result page does different... but it probably should all end up using the same and working code.
Created attachment 134260 [details] [review] Bug 30641: Quote authority id search
(In reply to Nick Clemens from comment #6) > Created attachment 134260 [details] [review] [review] > Bug 30641: Quote authority id search Not sure if you should solve it here. Elastic ?
(In reply to Katrin Fischer from comment #5) > The problematic one is get_usage_count - I found this while testing bug > 20615 that uses it and shows the wrong number. Not sure what the result page > does different... but it probably should all end up using the same and > working code. No, it is just a wrapper to SearchEngine code.
Marcel, can you explain the issue? We don't want to disable auto-truncate in general, so using "" like I think we have done in other places already makes sense to me. Nick, there is another query in Authorities.pm with an an-based search, maybe we should also fix that one?
... and we'll probably need a unit test
Looks like that Zebra has no problem with the an:"9" since it is a :w index in MARC21. In UNIMARC it is both :n and :w. But Zebra does not need it; SimpleSearch does not add the asterisks for truncation. Apparently, Elastic does because QueryBuilder is adding asterisks. Looks to me that this is actually a more general problem: Elastic's simple_search_compat is not 'simple' enough ;) The quotes are a workaround. Note: We are forming queries like an:1 in more places in code.
(In reply to Katrin Fischer from comment #10) > ... and we'll probably need a unit test Should this be "Failed QA" then?
(In reply to Magnus Enger from comment #12) > (In reply to Katrin Fischer from comment #10) > > ... and we'll probably need a unit test > > Should this be "Failed QA" then?