[Koha-bugs] [Bug 32707] ElasticSearch should not auto truncate (even if QueryAutoTruncate = 1) for identifiers (and some other fields)

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Jan 24 11:56:49 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32707

Janusz Kaczmarek <januszop at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|koha-bugs at lists.koha-commun |januszop at gmail.com
                   |ity.org                     |
             Status|NEW                         |Needs Signoff

--- Comment #1 from Janusz Kaczmarek <januszop at gmail.com> ---
Created attachment 145606
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=145606&action=edit
[PATCH] Bug 32707: ElasticSearch should not auto truncate (even if 
QueryAutoTruncate = 1) for identifiers (and some other fields)

Koha with Zebra prevented auto truncation in some circumstances -- see
the first return for ccl inside C4::Search:: buildQuery, before applying
auto truncation, and setting $auto_truncation = 0 for some search
fields.

Koha with ElasticSearch applies auto truncation for all search fields,
not paying attention to these special cases when it should not be done.
This leads to various problems as described in bug 26508, 26608, etc.

The solution would be to prevent auto truncation for certain search
fields, above all – the identifiers.  In addition, under no
circumstances should a search field other than of text type be truncated
(an attempt to truncate would generate an exception from ElasticSearch,
e.g. number_format_exception for integer).

Test plan
=========
Scenario A (authority)
----------------------
1. Enable Elasticsearch engine.
2. Have like 100+ bibliographic records and properly linked authority
   records.
3. Reindex ElasticSearch if needed.
4. Enable QueryAutoTruncate systempreference.
5. Find the authority record #1 and note the number of linked biblio
   records.
6. Show the detail of authority #1 and compare the number of linked
   biblio records.
7. If in the database there are authority records with ids =~ /^1/ (i.e.
   10, 11, 12, ..., 100, 101, ...) linked to the biblio records you get
   two different numbers of linked records.
8. Also, as lists of linked biblio records (via link: Used in N
   record(s) from results view and detail view) you will get two
   different sets of biblio records.  In particular, on the list generated
   from detail view (authorities/detail.pl?authid=1) you will get biblio
   records that are in fact not linked to the auth #1 (the list is
   generated with &q=an:1).
9. Apply this patch.
10. Counts and list of linked biblios should be ok.

Scenario B (analytics)
----------------------
1. Enable Elasticsearch engine.
2. Have three monographic bibliographic records with 001 = 1, 10, 100
   (i.e. =~ /^1/).
3. Have an analytical record with 773 $w = 1.
4. Reindex ElasticSearch if needed.
5. Enable QueryAutoTruncate and UseControlNumber systempreference.
6. Find the analytical record and click on the link generated from 773,
   i.e. (In: ... --> catalogue/search.pl?q=Control-number:1).
7. You should see a list of three records (001 = 1, 10, 100) instead of
   one (001 = 1).
8. Apply this patch.
9. Repeat step 6.  You should arrive at the right host record.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list