To reproduce: - Make sure you're running on a Perl 5.18 environment (e.g. Ubuntu 14.04 LTS) - Have UseQueryParser == "Don't try" - Perform a search typing just a word that would have many matches on your Zebra db. - Take note of the search results count. - Make sure you have the queryparser.yaml file in your config dir. - Set UseQueryParser == "Try" - Perform the same search a couple of times => FAIL: Notice that the search results count differs from one run to the other.
Created attachment 30630 [details] [review] Bug 12738: (regression tests) C4::Context should set keyword search as default for QueryParser This patch introduces tests for the QueryParser PQF driver usage in Koha. Specifically its initialization on C4::Context, and initial setup. It also introduces a .pl script that is used to load C4::Context with different hash randomization seeds on purpose, to verify the initialization result is deterministic and consistent between runs. To test: $ prove -v t/db_dependent/QueryParser.t It should fail because different default_search_class is set on each run, and it is not often the one we expect. Sponsored-by: Universidad Nacional de Cordoba
Created attachment 30631 [details] [review] Bug 12738: C4::Context should set 'keyword' as the default search class On a Perl 5.18 environment (e.g. Ubuntu 14.04 LTS): To reproduce: - Have UseQueryParser == "Don't try" - Perform a search typing just a word that would have many matches on your Zebra db. - Take note of the search results count. - Make sure you have the queryparser.yaml file in your config dir. - Set UseQueryParser == "Try" - Perform the same search a couple of times => FAIL: Notice that the search results count differs from one run to the other. - Run the regression tests $ prove -v t/db_dependent/QueryParser.t => FAIL: tests fail To test: - Apply the patch - Run tests $ prove -v t/db_dependent/QueryParser.t => SUCCESS: tests pass - Repeat the steps 'To reproduce' => SUCCESS: Search results count is deterministic :-D - Sign off :-D Sponsored-by: Universidad Nacional de Cordoba
Created attachment 30633 [details] [review] [SIGNED OFF] Bug 12738: (regression tests) C4::Context should set keyword search as default for QueryParser This patch introduces tests for the QueryParser PQF driver usage in Koha. Specifically its initialization on C4::Context, and initial setup. It also introduces a .pl script that is used to load C4::Context with different hash randomization seeds on purpose, to verify the initialization result is deterministic and consistent between runs. To test: $ prove -v t/db_dependent/QueryParser.t It should fail because different default_search_class is set on each run, and it is not often the one we expect. Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 30634 [details] [review] [SIGNED OFF] Bug 12738: C4::Context should set 'keyword' as the default search class On a Perl 5.18 environment (e.g. Ubuntu 14.04 LTS): To reproduce: - Have UseQueryParser == "Don't try" - Perform a search typing just a word that would have many matches on your Zebra db. - Take note of the search results count. - Make sure you have the queryparser.yaml file in your config dir. - Set UseQueryParser == "Try" - Perform the same search a couple of times => FAIL: Notice that the search results count differs from one run to the other. - Run the regression tests $ prove -v t/db_dependent/QueryParser.t => FAIL: tests fail To test: - Apply the patch - Run tests $ prove -v t/db_dependent/QueryParser.t => SUCCESS: tests pass - Repeat the steps 'To reproduce' => SUCCESS: Search results count is deterministic :-D - Sign off :-D Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Here's one I made earlier.. Luck would have it I'de just set up a pair of servers to test this exact bug when this report and patch appeared :) (I was doing this to verify a hunch related to QA on bug 10542). Happy to sign off, this patch fixes the bug and the test works as expected (fails on perl 5.18 pre the patch, passes post the patch). The test also passes on pre perl 5.18 regardless of the patch, which is also correct, as the bug only affects post 5.18 perl. I've also tested with and without the patch on a pre 5.18 environment for good measure.. all still works as expected.
Created attachment 30658 [details] [review] [PASSED QA] Bug 12738: (regression tests) C4::Context should set keyword search as default for QueryParser This patch introduces tests for the QueryParser PQF driver usage in Koha. Specifically its initialization on C4::Context, and initial setup. It also introduces a .pl script that is used to load C4::Context with different hash randomization seeds on purpose, to verify the initialization result is deterministic and consistent between runs. To test: $ prove -v t/db_dependent/QueryParser.t It should fail because different default_search_class is set on each run, and it is not often the one we expect. Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Created attachment 30659 [details] [review] [PASSED QA] Bug 12738: C4::Context should set 'keyword' as the default search class On a Perl 5.18 environment (e.g. Ubuntu 14.04 LTS): To reproduce: - Have UseQueryParser == "Don't try" - Perform a search typing just a word that would have many matches on your Zebra db. - Take note of the search results count. - Make sure you have the queryparser.yaml file in your config dir. - Set UseQueryParser == "Try" - Perform the same search a couple of times => FAIL: Notice that the search results count differs from one run to the other. - Run the regression tests $ prove -v t/db_dependent/QueryParser.t => FAIL: tests fail To test: - Apply the patch - Run tests $ prove -v t/db_dependent/QueryParser.t => SUCCESS: tests pass - Repeat the steps 'To reproduce' => SUCCESS: Search results count is deterministic :-D - Sign off :-D Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Now search with QueryParser always returns the correct number of results on a system with the newer Perl version. Passes all tests and QA script.
That was an evil bug - glad to see it fixed :)
Patches pushed to master.