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
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
Created attachment 23078 [details] [review] Bug 9578 - Error when search and sort not on relevance See commit message. In addition, C4::Search need a better error management. But this is another problem. In fact C4::Search is said to need a revamping.
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.
Created attachment 25891 [details] [review] [Signed-off] 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>
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.
Pushed to master, along with a regression test. Thanks, Fridolin!
Pushed to 3.14.x, will be in 3.14.10
Picked for 3.12.15!