Bug 9578 - Error when search and sort not on relevance
Summary: Error when search and sort not on relevance
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P3 minor (vote)
Assignee: Fridolin Somers
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-09 10:50 UTC by Michal Dudzik
Modified: 2015-06-04 23:30 UTC (History)
6 users (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 9578 - Error when search and sort not on relevance (1.27 KB, patch)
2013-11-22 10:11 UTC, Fridolin Somers
Details | Diff | Splinter Review
[Signed-off] Bug 9578 - Error when search and sort not on relevance (1.79 KB, patch)
2014-03-06 11:57 UTC, Marc Véron
Details | Diff | Splinter Review
[PASSED QA] Bug 9578 - Error when search and sort not on relevance (1.95 KB, patch)
2014-03-23 20:51 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 Michal Dudzik 2013-02-09 10:50:57 UTC
When search eg. phrase "fgdfgdfgdggdg (Exam 70-433)" and set sorting Title or Dates or Call number or Author or Popularity Gets error:
Can not call method "sort" on an undefined value at / home/magnus/kohahead/C4/Search.pm line 407th
Comment 1 Dobrica Pavlinusic 2013-08-30 12:55:30 UTC
I can't reproduce this problem on current master. I'm not sure, but my suspicion is that it was fixed by Bug 4393: Scan Indexes results cannot be sorted
Comment 2 Fridolin Somers 2013-11-22 10:11:58 UTC Comment hidden (obsolete)
Comment 3 Marc Véron 2014-03-06 07:55:05 UTC
Steps to reproduce the error:

In OPAC go to Advanced Search
Choose "Title" in first "Search for:" end enter fgdfgdfgdggdg (Exam 70-433)
Display "More options"
Set "Sort by" to "Title (A-Z)"
Click "Search" at bootom of page

Result: 
Error:
Can't call method "sort" on an undefined value at /usr/share/kohaclone/C4/Search.pm line 430.
Comment 4 Marc Véron 2014-03-06 11:57:42 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2014-03-23 20:51:43 UTC
Created attachment 26527 [details] [review]
[PASSED QA] Bug 9578 - Error when search and sort not on relevance

When searching with a sort (means not by relevance) and there is an error in Zebra connexion (server is down or query is wrong), you get the message :
  Error : Can't call method "sort" on an undefined value at /home/kohaadmin/src/C4/Search.pm line 405.

This patch corrects by not performing sort if no results.

Steps to reproduce the error without patch:

In OPAC go to Advanced Search
Choose "Title" in first "Search for:" end enter fgdfgdfgdggdg (Exam 70-433)
Display "More options"
Set "Sort by" to "Title (A-Z)"
Click "Search" at bootom of page

Result:
Error:
Can't call method "sort" on an undefined value at /usr/share/kohaclone/C4/Search.pm line 430.

Test plan :
- Set OPACdefaultSortField on something else than relevance
- Perform a simple search with a wrong CCL query. For example : ccl=( and )
=> You get the messge : No results found ...

Patch behaves as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Adds another check to prevent a bad Zebra error message.
Works as described, passes all tests and QA script.
Comment 6 Galen Charlton 2014-04-18 22:35:14 UTC
Pushed to master, along with a regression test.  Thanks, Fridolin!
Comment 7 Fridolin Somers 2014-08-06 12:21:58 UTC
Pushed to 3.14.x, will be in 3.14.10
Comment 8 Kyle M Hall 2014-08-13 15:35:33 UTC
Picked for 3.12.15!