Bug 12738 - Search behaviour inconsistent with QueryParser on Perl 5.18
Summary: Search behaviour inconsistent with QueryParser on Perl 5.18
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Galen Charlton
URL:
Keywords:
Depends on:
Blocks: 12742
  Show dependency treegraph
 
Reported: 2014-08-08 13:03 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2020-02-24 20:53 UTC (History)
3 users (show)

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


Attachments
Bug 12738: (regression tests) C4::Context should set keyword search as default for QueryParser (5.11 KB, patch)
2014-08-08 15:12 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 12738: C4::Context should set 'keyword' as the default search class (1.64 KB, patch)
2014-08-08 15:12 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
[SIGNED OFF] Bug 12738: (regression tests) C4::Context should set keyword search as default for QueryParser (5.19 KB, patch)
2014-08-08 16:07 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
[SIGNED OFF] Bug 12738: C4::Context should set 'keyword' as the default search class (1.72 KB, patch)
2014-08-08 16:08 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
[PASSED QA] Bug 12738: (regression tests) C4::Context should set keyword search as default for QueryParser (5.24 KB, patch)
2014-08-10 15:16 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 12738: C4::Context should set 'keyword' as the default search class (1.91 KB, patch)
2014-08-10 15:17 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 Tomás Cohen Arazi (tcohen) 2014-08-08 13:03:40 UTC
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.
Comment 1 Tomás Cohen Arazi (tcohen) 2014-08-08 15:12:03 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi (tcohen) 2014-08-08 15:12:10 UTC Comment hidden (obsolete)
Comment 3 Martin Renvoize (ashimema) 2014-08-08 16:07:46 UTC Comment hidden (obsolete)
Comment 4 Martin Renvoize (ashimema) 2014-08-08 16:08:28 UTC Comment hidden (obsolete)
Comment 5 Martin Renvoize (ashimema) 2014-08-08 16:12:29 UTC
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.
Comment 6 Katrin Fischer 2014-08-10 15:16:49 UTC
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>
Comment 7 Katrin Fischer 2014-08-10 15:17:08 UTC
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.
Comment 8 Katrin Fischer 2014-08-10 15:18:41 UTC
That was an evil bug - glad to see it fixed :)
Comment 9 Tomás Cohen Arazi (tcohen) 2014-08-11 13:26:09 UTC
Patches pushed to master.