Bugzilla – Attachment 187397 Details for
Bug 39630
Problems with search for dateaccessioned (ElasticSearch)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39630: WIP - Index 'Date' fields as a date type in Elasticsearch
Bug-39630-WIP---Index-Date-fields-as-a-date-type-i.patch (text/plain), 2.00 KB, created by
Nick Clemens (kidclamp)
on 2025-10-03 14:00:17 UTC
(
hide
)
Description:
Bug 39630: WIP - Index 'Date' fields as a date type in Elasticsearch
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-10-03 14:00:17 UTC
Size:
2.00 KB
patch
obsolete
>From 1dc3a31ee56c7dcc10abc8b081f56a06eebe160f Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 3 Oct 2025 12:59:57 +0000 >Subject: [PATCH] Bug 39630: WIP - Index 'Date' fields as a date type in > Elasticsearch > >This patch adds a 'date' format to the field_config and makes sure this is used for fields marked as >Date in the ES config > >Currently 'Date' fields are indexed as standard and get keyword and text variations in ES - these field types cannot >be used for range searching, so, will we try to build range queries correctly, they will not return results. > >TO DO: >We currently escape the brackets when building a range query, i.e.: >'(date-of-acquisition:\\[2015-01-05 2016-01-05\\])' > >This does not work, we need to pass the brackets as brackets to allow ranges to work correctly >--- > Koha/SearchEngine/Elasticsearch.pm | 2 ++ > admin/searchengine/elasticsearch/field_config.yaml | 2 ++ > 2 files changed, 4 insertions(+) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index 53afa2929d0..2abd8f1eb38 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -215,6 +215,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'; > } elsif ( $type eq 'year' ) { > $es_type = 'year'; > } elsif ( $type eq 'callnumber' ) { >diff --git a/admin/searchengine/elasticsearch/field_config.yaml b/admin/searchengine/elasticsearch/field_config.yaml >index 41adcef7ed8..b94dd190765 100644 >--- a/admin/searchengine/elasticsearch/field_config.yaml >+++ b/admin/searchengine/elasticsearch/field_config.yaml >@@ -21,6 +21,8 @@ search: > boolean: > type: boolean > null_value: false >+ date: >+ type: date > integer: > type: integer > null_value: 0 >-- >2.39.5
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 39630
: 187397