Bug 25378

Summary: Fix search on publication date in elasticsearch
Product: Koha Reporter: Julian Maurice <julian.maurice>
Component: Searching - ElasticsearchAssignee: Julian Maurice <julian.maurice>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P5 - low CC: anne-cecile.bories
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 25378: Fix search on publication date in elasticsearch

Description Julian Maurice 2020-05-05 12:35:22 UTC

    
Comment 1 Julian Maurice 2020-05-05 12:36:13 UTC
Created attachment 104361 [details] [review]
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
Comment 2 Katrin Fischer 2020-05-05 20:15:53 UTC
Hi Julian, not sure, but is this related to bug 24559?
Comment 3 Julian Maurice 2020-05-06 06:35:58 UTC
(In reply to Katrin Fischer from comment #2)
> Hi Julian, not sure, but is this related to bug 24559?

Yes, totally. Bug 24599 looks like a better alternative.
Closing as duplicate, thanks Katrin.

*** This bug has been marked as a duplicate of bug 24559 ***