Bug 10281 - Search domains do not seem to work
Summary: Search domains do not seem to work
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Jared Camins-Esakov
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-18 11:32 UTC by Magnus Enger
Modified: 2013-12-05 20:09 UTC (History)
1 user (show)

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


Attachments
Bug 10281: searching for a search domain fails (2.33 KB, patch)
2013-05-18 13:22 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 10281: searching for a search domain fails (2.95 KB, patch)
2013-05-18 20:38 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 10281: searching for a search domain fails (3.44 KB, patch)
2013-05-18 22:08 UTC, Magnus Enger
Details | Diff | Splinter Review
[PASSED QA] Bug 10281: searching for a search domain fails (3.61 KB, patch)
2013-05-19 10:01 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2013-05-18 11:32:13 UTC
I added two libraries and added them to a search domain (with code "NARVIK"). One of them owns "The hobbit" and the other owns "Lord of the rings". 

- When I search for "hobbit" in the first library I get one hit as expected. 
- When I search for "rings" in the second library I also get one hit as expected. 
- When I search for "tolkien" in the group I get no results. 
- When I search for "hobbit" or "rings" in the group I get no results.
- When I search for "tolkien" in "all libraries" I get two hits, as expected. 

Are search domains (a.k.a "search groups of libraries") broken or is there some missing config step? The documentation does not seem to mention anything of that sort. 

The URLs for the search limited to the search domain looks like this:

OPAC, simple search (with OpacAddMastheadLibraryPulldown activated):
/cgi-bin/koha/opac-search.pl?q=tolkien&branch_group_limit=multibranchlimit-NARVIK

OPAC, advanced search:
/opac-search.pl?idx=kw&q=tolkien&idx=kw&idx=kw&do=Søk&multibranchlimit=NARVIK&sort_by=relevance

Intranet search:
/cgi-bin/koha/catalogue/search.pl?idx=kw&q=tolkien&idx=kw&idx=kw&multibranchlimit=NARVIK&sort_by=relevance

I have tried a full "sudo koha-rebuild-zebra -f -v <instancename>", but that did not change anything.

Tested on 3.12 rc2 package install, no memcached or anything else fancy.
Comment 1 Magnus Enger 2013-05-18 12:05:49 UTC
Here are the errors I get when I limit to a group and get no results:

OPAC, simple search:

[Sat May 18 14:04:01 2013] [error] [client 109.189.7.19] [Sat May 18 14:04:01 2013] opac-search.pl: Use of uninitialized value $_ in pattern match (m//) at /usr/share/koha/opac/cgi-bin/opac/opac-search.pl line 34., referer: http://nvgs.test312.bibkat.no/cgi-bin/koha/opac-search.pl?q=tolkien&branch_group_limit=multibranchlimit-NARVIK
[Sat May 18 14:04:01 2013] [error] [client 109.189.7.19] [Sat May 18 14:04:01 2013] opac-search.pl: Use of uninitialized value $_ in pattern match (m//) at /usr/share/koha/opac/cgi-bin/opac/opac-search.pl line 39., referer: http://nvgs.test312.bibkat.no/cgi-bin/koha/opac-search.pl?q=tolkien&branch_group_limit=multibranchlimit-NARVIK
[Sat May 18 14:04:01 2013] [error] [client 109.189.7.19] [Sat May 18 14:04:01 2013] opac-search.pl: WARNING: query problem with kw,wrdl,rtrn=tolkien and () ZOOM error 10014 "CCL parsing error" (addinfo: "Search word expected") from diag-set 'ZOOM' at /usr/share/koha/lib/C4/Search.pm line 378., referer: http://nvgs.test312.bibkat.no/cgi-bin/koha/opac-search.pl?q=tolkien&branch_group_limit=multibranchlimit-NARVIK

OPAC, advanced search:

[Sat May 18 14:04:13 2013] [error] [client 109.189.7.19] [Sat May 18 14:04:13 2013] opac-search.pl: Use of uninitialized value $_ in pattern match (m//) at /usr/share/koha/opac/cgi-bin/opac/opac-search.pl line 34., referer: http://nvgs.test312.bibkat.no/cgi-bin/koha/opac-search.pl?q=tolkien&branch_group_limit=multibranchlimit-NARVIK
[Sat May 18 14:04:13 2013] [error] [client 109.189.7.19] [Sat May 18 14:04:13 2013] opac-search.pl: Use of uninitialized value $_ in pattern match (m//) at /usr/share/koha/opac/cgi-bin/opac/opac-search.pl line 39., referer: http://nvgs.test312.bibkat.no/cgi-bin/koha/opac-search.pl?q=tolkien&branch_group_limit=multibranchlimit-NARVIK
[Sat May 18 14:04:22 2013] [error] [client 109.189.7.19] [Sat May 18 14:04:22 2013] opac-search.pl: Use of uninitialized value $_ in pattern match (m//) at /usr/share/koha/opac/cgi-bin/opac/opac-search.pl line 34., referer: http://nvgs.test312.bibkat.no/cgi-bin/koha/opac-search.pl
[Sat May 18 14:04:22 2013] [error] [client 109.189.7.19] [Sat May 18 14:04:22 2013] opac-search.pl: Use of uninitialized value $_ in pattern match (m//) at /usr/share/koha/opac/cgi-bin/opac/opac-search.pl line 39., referer: http://nvgs.test312.bibkat.no/cgi-bin/koha/opac-search.pl
[Sat May 18 14:04:23 2013] [error] [client 109.189.7.19] [Sat May 18 14:04:23 2013] opac-search.pl: WARNING: query problem with kw,wrdl,rtrn=tolkien and () ZOOM error 10014 "CCL parsing error" (addinfo: "Search word expected") from diag-set 'ZOOM' at /usr/share/koha/lib/C4/Search.pm line 378., referer: http://nvgs.test312.bibkat.no/cgi-bin/koha/opac-search.pl
Comment 2 Jared Camins-Esakov 2013-05-18 13:22:33 UTC Comment hidden (obsolete)
Comment 3 Jared Camins-Esakov 2013-05-18 20:38:17 UTC Comment hidden (obsolete)
Comment 4 Magnus Enger 2013-05-18 22:08:59 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2013-05-19 10:01:25 UTC
Created attachment 18236 [details] [review]
[PASSED QA] Bug 10281: searching for a search domain fails

For reasons I cannot fathom, the split() in handling multi-branch
limits was not coming up with a valid search group code. Replacing
the split() with a substr() and creating the CGI parameter as a string
rather than as an arrayref fixes the problem. This problem may not
affect all installations, since I tested this exact feature just under
two months ago and it worked fine, and none of the relevant code has
been changed since then that I can see.

To test:
1) Create search group, and add at least one library to it, in
   /cgi-bin/koha/admin/branches.pl
2) Apply patch
3) Try doing a search limited to your search group, making sure that
   the search will match items that belong to a library in the search
   group
4) Sign off

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
I have failed to recreate the problem on three different dev installs,
both on Ubuntu and Debian, but the current patch does not break
anything as far as I can tell, so I'm signing off.

I tested with two libraries in the same search domain, with each
library owning a different book by the same author. Searching for
the author in
- all libraries,
- individual libraries and
- the search domain that contains both libraries
all return the expected results.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
I couldn't reproduce the problem, but didn't find any regressions.
Comment 6 Jared Camins-Esakov 2013-05-19 12:39:58 UTC
This patch has been pushed to master and 3.12.x.