Koha-clms/Koha/SearchEngine
Nick Clemens 890fd6ff06 Bug 23828: Elasticsearch - Preserve record order when combining subfield in mappings
Currently if you combine subfields in the marc mappings the subfields are indexed in the order
listed in the mapping.

i.e. 650(avxyz) in mapping

and in record:
650 $aHeading $zGeosubdiv $vFormsubdiv

is indexed as:
Heading Formsubdiv Geosubdiv

We should preserve the order and index as:
Heading Geosubdiv Formsubdiv

We can use built in function in Marc::Field to achieve this

To test:
 1 - It is easy to find examples of this using authorities
 2 - Find or create a record with subfields order azv
     e.g. 150$aActresses$zUnited states$vBiography
 3 - Add or have a second authority
     e.g. 150$aActresses$vPortraits
 4 - Set an authorities mapping for 'Heading' to 150(abgvxyz)
     find at:
     Administration->Search engine configuration (Elasticsearch)->Authorities tab
 5 - Index the records in Elasticsearch
     perl misc/search_tools/rebuild_elaticsearch.pl -a -ai 1691 -ai 1692
 6 - View the first record in the ES index
     curl es:9200/koha_kohadev_authorities/data/1692?pretty
 7 - Note 'Heading' field is ordered as in the mapping
 8 - Search authorities for 'contains' "act"
 9 - Note the records sort incorrectly
10 - Apply patches
11 - perl misc/search_tools/rebuild_elaticsearch.pl -a -ai 1692
12 - curl es:9200/koha_kohadev_authorities/data/1692?pretty
13 - Note the order is now preserved
14 - Search authorities for 'contains' "act"
15 - Note the records sort correctly

Signed-off-by: Heather Hernandez <heather_hernandez@nps.gov>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

JD amended patch: Fix
   FAIL   spelling
     combind ==> combined

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-10-22 10:04:30 +02:00
..
Elasticsearch Bug 26600: Missing module in Elasticsearch/Indexer.pm 2020-10-08 14:50:03 +02:00
Zebra Bug 25265: (QA follow-up) Rename biblionumber in ModZebra, index_records 2020-09-28 10:10:08 +02:00
Elasticsearch.pm Bug 23828: Elasticsearch - Preserve record order when combining subfield in mappings 2020-10-22 10:04:30 +02:00
Indexer.pm Bug 25265: Prevent double reindex of the same item in batchmod 2020-09-28 10:10:08 +02:00
QueryBuilder.pm Bug 12478: allow more granular sorting configuration 2016-04-26 20:20:08 +00:00
Search.pm Bug 22721: Remove frameworkcode parameter in GetMarcFromKohaField calls 2019-07-15 11:28:08 +01:00