Bug 26608 - Authorities: linked biblios is inconsistent using elasticsearch and QueryAutoTruncate
Summary: Authorities: linked biblios is inconsistent using elasticsearch and QueryAuto...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Alex Arnaud
QA Contact:
URL:
Keywords:
: 29724 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-10-05 08:53 UTC by Alex Arnaud
Modified: 2023-12-28 20:43 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 26608: Elasticsearch - add exact (ext) field type and use it for linked biblios (3.87 KB, patch)
2020-10-05 09:04 UTC, Alex Arnaud
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Arnaud 2020-10-05 08:53:05 UTC
Using ES and QueryAutoTruncate systempreference enabled, the count and list of linked biblios is wrong. This is because auto-truncate feature change the query "an:1" to "an:1*". So all biblio linked to an authid like 15, 1042, 11234 match the query.
Comment 1 Alex Arnaud 2020-10-05 09:04:07 UTC
Created attachment 111212 [details] [review]
Bug 26608: Elasticsearch - add exact (ext) field type and use it for linked biblios

Test plan:
 - Enable Elasticsearch engine,
 - Enable QueryAutoTruncate systempreference,
 - Show the detail od authority #1
   (cgi-bin/koha/authorities/detail.pl?authid=1)
 - note the inconsistent count of linked biblio (and so the list),
 - Apply this patch,
 - Restart all,
 - repeat previous step,
 - Count and list of linked biblios should be ok.
Comment 2 Fridolin Somers 2021-12-18 07:23:04 UTC
*** Bug 29724 has been marked as a duplicate of this bug. ***
Comment 3 Filipe Ribeiro 2021-12-20 14:56:24 UTC
Just realized that the problem also occurs at linked_biblionumbers. 
https://github.com/Koha-Community/Koha/blob/master/Koha/Authorities.pm#L81

Basically, when simple_search_compat is used, instead of id "1" , its searched "1*". This returns all biblios with authorities that starts with the number 1.
Comment 4 David Nind 2022-09-14 21:32:16 UTC
I've changed the status to "Needs Signoff"
Comment 5 David Nind 2022-09-14 21:48:36 UTC
Patch no longer applies 8-(...

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 26608: Elasticsearch - add exact (ext) field type and use it for linked biblios
Using index info to reconstruct a base tree...
M	Koha/Authorities.pm
M	Koha/SearchEngine/Elasticsearch/QueryBuilder.pm
M	koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt
Auto-merging Koha/SearchEngine/Elasticsearch/QueryBuilder.pm
CONFLICT (content): Merge conflict in Koha/SearchEngine/Elasticsearch/QueryBuilder.pm
Auto-merging Koha/Authorities.pm
error: Failed to merge in the changes.
Patch failed at 0001 Bug 26608: Elasticsearch - add exact (ext) field type and use it for linked biblios
Comment 6 Frédéric Demians 2023-05-23 08:23:21 UTC
For me this bug doesn't exist anymore in master, and so, could be closed. In PRO, authorities-home.pl page display valid authorities usage count. On the other hand, a similar issue persists in OPAC: see bug 33802.