Koha/admin/searchengine/elasticsearch/field_config.yaml
David Gustafsson d1c8d7ecce Bug 24807: Add "year" type to improve sorting behaviour
Add a "year" search field type. Fields with this type will only
retain values that looks like years, so invalid values such as
whitespace or word characters will not be indexed.
This for instance improves the behaviour when sorting by
"date-of-publication". If all values are indexed, records with
junk data instead of valid years will appear first among the search
results, drowning out more relevant hits. If assigning this field
the "year" type these records will instead always appear last,
regarless of sort order.

To test:

1) Have at least two biblios, one with a valid year in 008 (pos 7-10)
and another with an invalid one ("uuuu" for example)
2) Perform a wildcard search (*) and sort results by publication date.
3) The record with invalid year of pulication in 008 should appear first
4) Apply patch and run database updates
5) Reindex ElasticSearch
6) Perform the same search as in 2)
7) The record with the invalid year should now appear last

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-09-18 11:21:31 +02:00

73 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