Bug 17484 - Searching with date range limit (lower and upper) does not work
Summary: Searching with date range limit (lower and upper) does not work
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P2 major
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-21 15:55 UTC by Koha Team University Lyon 3
Modified: 2019-06-27 09:24 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug_17484 Searching with date range limit (lower and upper) does not work (1.03 KB, patch)
2016-10-21 16:00 UTC, Koha Team University Lyon 3
Details | Diff | Splinter Review
Proposed patch (1.09 KB, patch)
2016-10-24 11:01 UTC, Colin Campbell
Details | Diff | Splinter Review
Bug 17484 - Searching with date range limit (lower and upper) does not work (1.75 KB, patch)
2016-10-25 11:51 UTC, Koha Team University Lyon 3
Details | Diff | Splinter Review
Bug_17484 Search with date range limit (lower and upper) does not work (1.88 KB, patch)
2016-11-17 15:54 UTC, Mirko Tietgen
Details | Diff | Splinter Review
Bug_17484 Search with date range limit (lower and upper) does not work (1.96 KB, patch)
2016-11-18 09:26 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Koha Team University Lyon 3 2016-10-21 15:55:07 UTC
When you do a search through advanced search with a publication date range limit (like 2002-2006 by example) according the example given in the legend, you get no results even if there must be ones.

It's ok for one-bound limits like -2002 or 2006-, but for two bounds limits you must wrap the hypen with spaces to get results, which is not consistent with the legend.

Whitout spaces the query sent to zebra is done by opac-search.pl script like this :
kw,wrdl,rtrn=MY_SEARCH and yr,st-numeric,ge=2002 and yr,st-numeric,le=2006
Seems that Zebra does not understand that syntax.
With spaces, it is turned out like this :
kw,wrdl,rtrn=MY_SEARCH and yr,st-numeric=2002 - 2006
and it works.
It also works without spaces if you run a ccl query directly from the opac :
ccl=kw,wrdl,rtrn=archipel and yr,st-numeric=2002-2006

May be it's a question of zebra config or zebra version, not completely sure of this (cf bug 12897), I propose this patch nevertheless as an eventuel solution.

Test plan :
1) do a search from advanced search with some results
2) redo the same putting a date limit with two bounds separated by an hypen without spaces : you get no results
3) apply the patch
4) redo stage 2 : you get the expected results
Comment 1 Koha Team University Lyon 3 2016-10-21 16:00:16 UTC
Created attachment 56726 [details] [review]
Bug_17484 Searching with date range limit (lower and upper) does not work
Comment 2 Colin Campbell 2016-10-24 10:03:02 UTC
This change in Yaz

--- 5.15.0 2015/11/11

CCL: fix r=o, r=r WRT inherited attributes YAZ-864

appears that it may be the point at which the syntax was tightened up
Comment 3 Colin Campbell 2016-10-24 11:01:33 UTC
Created attachment 56742 [details] [review]
Proposed patch

Tested on two systems one exhibiting the bug and one not on both date ranges now work as advertised
Comment 4 Colin Campbell 2016-10-24 11:02:30 UTC
Signed Off bug - patch fixes problem
Comment 5 Jonathan Druart 2016-10-25 08:28:02 UTC
You should make the same changes for the intranet script (catalogue/search.pl) as well.
Comment 6 Koha Team University Lyon 3 2016-10-25 11:51:21 UTC
Created attachment 56842 [details] [review]
Bug 17484 - Searching with date range limit (lower and upper) does not work

added same modification on staff interface
Comment 7 Mirko Tietgen 2016-11-17 15:54:04 UTC
Created attachment 57606 [details] [review]
Bug_17484 Search with date range limit (lower and upper) does not work

If the period is entered without spaces wrapping the hyphen
You can't get any result

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
I can't reproduce the error, search still works after applying the patch
Comment 8 Jonathan Druart 2016-11-18 08:45:21 UTC
I do not recreate the error (whereas I did when I tried it last month).

I am using kohadevbox, and yaz 4.2.30-4.
Comment 9 Colin Campbell 2016-11-18 08:56:51 UTC
(In reply to Jonathan Druart from comment #8)
> I do not recreate the error (whereas I did when I tried it last month).
> 
> I am using kohadevbox, and yaz 4.2.30-4.

If the change I listed above is the one causing the old code to cease to work you need a yaz version > 5.15 to manifest the problem. This bears out what I've observed in a number of sites later yaz manifests the problem earlier ones dont. Fix works for all
Comment 10 Jonathan Druart 2016-11-18 09:26:45 UTC
Created attachment 57622 [details] [review]
Bug_17484 Search with date range limit (lower and upper) does not work

If the period is entered without spaces wrapping the hyphen
You can't get any result

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
I can't reproduce the error, search still works after applying the patch

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Jonathan Druart 2016-11-18 09:29:14 UTC
(In reply to Colin Campbell from comment #9)
> (In reply to Jonathan Druart from comment #8)
> > I do not recreate the error (whereas I did when I tried it last month).
> > 
> > I am using kohadevbox, and yaz 4.2.30-4.
> 
> If the change I listed above is the one causing the old code to cease to
> work you need a yaz version > 5.15 to manifest the problem. This bears out
> what I've observed in a number of sites later yaz manifests the problem
> earlier ones dont. Fix works for all

It looks like jessie, stretch and sid are all using 4.2.30
Comment 12 Mirko Tietgen 2016-11-18 10:20:01 UTC
(In reply to Jonathan Druart from comment #11)

> It looks like jessie, stretch and sid are all using 4.2.30

You can get 5.x from IndexData, but it's not going to be in Debian anytime soon I guess.
Comment 13 Kyle M Hall (khall) 2016-11-18 13:46:14 UTC
Pushed to master for 16.11, thanks Koha Team Lyon 3!
Comment 14 Julian Maurice 2016-11-30 13:06:13 UTC
Pushed to 3.22.x, will be in 3.22.13
Comment 15 Mason James 2016-12-14 12:09:20 UTC
Pushed to 16.05.x, for 16.05.06 release