Koha-clms/cataloguing
Fridolin Somers 6830a61918 Bug 20151: always use current language for stemming
When stemming is enabled, in catalog searching "C4::Search::_build_stemmed_operand" will transform query operand into stemmed operand using stemmer Lingua::Stem::Snowball with a specified language.
This stemmer returns undef stemmed operand if no language is defined.

In main catalog search (catalogue/search.pl) current language is used.
But in other pages "acqui/neworderbiblio.pl" and "cataloguing/addbooks.pl" no language is defined so stemmed operand is empty and so stemming is not applied.

This patch corrects by returning in "C4::Search::_build_stemmed_operand" operand without change if no langage is defined.
And uses current langage in pages "acqui/neworderbiblio.pl" and "cataloguing/addbooks.pl" so all catalog search uses stemming.

Test plan :
1) Enable system preferences QueryStemming and QueryWeightFields
2) Disable system preferences QueryAutoTruncate, QueryFuzzy and UseQueryParser
3) Go to intranet main page and click on "Search the catalog" tab
4) Perform a search (without index) that uses the stemming, for example searching for "years" will also match "year"
5) Note how many results you get, for example "year" gets 24 results and "years" gets 24 results
6) Go to "Cataloging" module
7) Perform a search on same word in "Cataloging search" tab
8) Note how many results you get
9) Without patch you get fewer results than first search (step 5) because stemming is not applied, for example "year" gets 11 results and "years" gets 15 results
10) With patch you get the same results as first search (step 5) because stemming is applied, for example "year" and "years" gets 24 results
11) Same tests in aquisition module
12) On a basket, click "Add to basket" and perform a search in "From an existing record"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 78a692dee4)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 2170698ab9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2018-10-15 16:55:49 +02:00
..
value_builder Bug 21053: Encode URI characters in plugin 008 2018-09-21 11:30:18 +02:00
addbiblio.pl Bug 14662: Add empty entries to pull downs in cataloguing form for mandatory subfields 2018-08-28 15:06:51 +02:00
addbooks.pl Bug 20151: always use current language for stemming 2018-10-15 16:55:49 +02:00
additem.pl Bug 14662: Add empty entries to pull downs on item form for mandatory subfields 2018-08-28 15:06:27 +02:00
editor.pl Bug 11559: (QA followup) fix several small issues 2015-10-27 12:25:01 -03:00
linkitem.pl Bug 20829: Handle non-existent barcode when linking to host item 2018-06-14 15:13:51 +02:00
merge.pl Bug 18593: Move suggestions when bibliographic records are merged 2018-04-23 22:29:01 +00:00
merge_ajax.pl Bug 14588: Simplify merge_ajax.pl 2015-08-21 10:21:39 -03:00
moveitem.pl Bug 18262: Koha::Biblio - Remove GetBiblioData - part 1 2017-07-14 12:22:23 -03:00
plugin_launcher.pl Bug 16154: CGI->multi_param - Force scalar context 2016-04-26 23:16:43 +00:00
ysearch.pl Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
z3950_auth_search.pl Bug 16154: CGI->multi_param - Force scalar context 2016-04-26 23:16:43 +00:00
z3950_search.pl Bug 16154: CGI->multi_param - Declare a list 2016-04-26 23:16:42 +00:00