Koha/admin/searchengine/elasticsearch/field_config.yaml
Nick Clemens b8b8a62f11
Bug 29632: Don't sort cn-sort numerically
When defining our sort fields in we defined all as 'numeric'

For other string containing numbers this is likely correct, however,
for callnumbers it is not. e.g. E45 should sort before E7

This patch adds a new 'callnumber' type and deifnes this for cn-sort and
adds to the field maping a sort without numeric set

To test:
0 - Be using ES with Koha
1 - On records with single item, add callnumbers:
    VA65 E7 R63 1984
    VA65 E7 T35 1990
    VA65 E45 R67 1985
2 - Add public note 'shrimp' or something to make them easily searchable as a group
3 - Search for 'shrimp', sort by callnumber
4 - Note E45 comes last, it should come first
5 - Apply patch
6 - Reset ES mappings
7 - Reindex ES
8 - Repeat search
9 - Sorting should be correct when set to callnumber

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Michal Urban <michalurban177@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-18 11:21:47 -03:00

77 lines
1.4 KiB
YAML

---
# General field configuration
general:
properties:
marc_data:
store: true
type: text
analyzer: keyword
index: false
marc_data_array:
type: object
dynamic: true
marc_format:
store: true
type: text
analyzer: keyword
index: false
# Search fields
search:
boolean:
type: boolean
null_value: false
integer:
type: integer
null_value: 0
ignore_malformed: true
year:
type: short
stdno:
type: text
analyzer: analyzer_stdno
search_analyzer: analyzer_stdno
fields:
phrase:
type: text
analyzer: analyzer_phrase
search_analyzer: analyzer_phrase
raw:
type: keyword
default:
type: text
analyzer: analyzer_standard
search_analyzer: analyzer_standard
fields:
phrase:
type: text
analyzer: analyzer_phrase
search_analyzer: analyzer_phrase
raw:
type: keyword
normalizer: nfkc_cf_normalizer
ci_raw:
type: keyword
normalizer: icu_folding_normalizer
# Facets
facet:
default:
type: keyword
normalizer: facet_normalizer
# Suggestible
suggestible:
default:
type: completion
analyzer: simple
max_input_length: 100
search_analyzer: simple
# Sort
sort:
default:
type: icu_collation_keyword
index: false
numeric: true
cn_sort:
type: icu_collation_keyword
index: false
numeric: false