Bug 17484

Summary: Searching with date range limit (lower and upper) does not work
Product: Koha Reporter: Koha Team University Lyon 3 <koha>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P2 CC: colin.campbell, janet.mcgowan, jonathan.druart, julian.maurice, koha, kyle, mirko, mtj
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12897
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug_17484 Searching with date range limit (lower and upper) does not work
Proposed patch
Bug 17484 - Searching with date range limit (lower and upper) does not work
Bug_17484 Search with date range limit (lower and upper) does not work
Bug_17484 Search with date range limit (lower and upper) does not work

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 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