Bugzilla – Attachment 104361 Details for
Bug 25378
Fix search on publication date in elasticsearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25378: Fix search on publication date in elasticsearch
Bug-25378-Fix-search-on-publication-date-in-elasti.patch (text/plain), 2.23 KB, created by
Julian Maurice
on 2020-05-05 12:36:13 UTC
(
hide
)
Description:
Bug 25378: Fix search on publication date in elasticsearch
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2020-05-05 12:36:13 UTC
Size:
2.23 KB
patch
obsolete
>From 7d56bce6efcb1422d061ada905c258e81b6e4e8f Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Tue, 5 May 2020 10:49:47 +0200 >Subject: [PATCH] Bug 25378: Fix search on publication date in elasticsearch > >Index 'date' fields as integer so that a query like > > copydate:[1900 TO *] > >works correctly > >Malformed values (values that are not integer) will be ignored by >elasticsearch > >Test plan: >1. Create two biblios, one with a valid year in the copydate field, one > with an invalid year. The copydate field depends on your configuration > (by default it's 260$c for MARC21 and NORMARC) > Valid value example: "2301" > Invalid value example: "year 2301" >2. Run `misc/search_tools/rebuild_elasticsearch.pl -b -d` >3. Go to OPAC advanced search, and in the "Publication date range" >filter, type: "2301", you should get only one result (the "valid" >biblio) >4. Try the following searches: > - "2301-2301" > - "2300-2302" > - "2300-" > They should all return the valid biblio >5. Try "2302-". You should get no results >6. Do the same at staff interface >--- > Koha/SearchEngine/Elasticsearch.pm | 2 ++ > admin/searchengine/elasticsearch/field_config.yaml | 3 +++ > 2 files changed, 5 insertions(+) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index 6616671325..9295b9bb7c 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -217,6 +217,8 @@ sub get_elasticsearch_mappings { > $es_type = 'integer'; > } elsif ($type eq 'isbn' || $type eq 'stdno') { > $es_type = 'stdno'; >+ } elsif ($type eq 'date') { >+ $es_type = 'date'; > } > > if ($search) { >diff --git a/admin/searchengine/elasticsearch/field_config.yaml b/admin/searchengine/elasticsearch/field_config.yaml >index 8723a0713c..6488b617f7 100644 >--- a/admin/searchengine/elasticsearch/field_config.yaml >+++ b/admin/searchengine/elasticsearch/field_config.yaml >@@ -35,6 +35,9 @@ search: > search_analyzer: analyzer_phrase > raw: > type: keyword >+ date: >+ type: integer >+ ignore_malformed: true > default: > type: text > analyzer: analyzer_standard >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25378
: 104361