Bug 18374 - Respect QueryAutoTruncate syspref in Elasticsearch
Summary: Respect QueryAutoTruncate syspref in Elasticsearch
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: master
Hardware: All All
: P3 major (vote)
Assignee: Nick Clemens
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-03 18:30 UTC by Nick Clemens
Modified: 2017-09-12 15:18 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 18374 - Respect QueryAutoTruncate syspref in Elasticsearch (2.06 KB, patch)
2017-04-03 18:37 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 18374 - QueryAutoTruncate unit tests (1.62 KB, patch)
2017-04-06 18:55 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 18374 - Respect QueryAutoTruncate syspref in Elasticsearch (2.10 KB, patch)
2017-04-06 18:55 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 18374 - QueryAutoTruncate unit tests (1.95 KB, patch)
2017-04-06 19:45 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 18374 - Respect QueryAutoTruncate syspref in Elasticsearch (2.12 KB, patch)
2017-04-06 19:45 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 18374 - Respect QueryAutoTruncate syspref in Elasticsearch (2.39 KB, patch)
2017-04-08 03:44 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 18374 - QueryAutoTruncate unit tests (2.30 KB, patch)
2017-07-07 10:37 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 18374 - Respect QueryAutoTruncate syspref in Elasticsearch (2.39 KB, patch)
2017-07-07 10:37 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 18374: QueryAutoTruncate unit tests (2.30 KB, patch)
2017-09-12 15:17 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 18374: Respect QueryAutoTruncate syspref in Elasticsearch (2.39 KB, patch)
2017-09-12 15:17 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 18374: (QA followup) Remove warning in Elasticsearch/Search.pm (1022 bytes, patch)
2017-09-12 15:17 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2017-04-03 18:30:40 UTC
Currently in Elasticsearch a search for 
'shakes' 
will not match 
'shakespeare'
but you cna force it with
'shakes*'

This patchset will obey the QueryAutoTruncate to add '*' to all search terms
Comment 1 Nick Clemens 2017-04-03 18:37:07 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2017-04-03 18:51:27 UTC Comment hidden (obsolete)
Comment 3 Nick Clemens 2017-04-06 18:55:28 UTC Comment hidden (obsolete)
Comment 4 Nick Clemens 2017-04-06 18:55:33 UTC Comment hidden (obsolete)
Comment 5 Nick Clemens 2017-04-06 19:45:26 UTC
Created attachment 61954 [details] [review]
Bug 18374 - QueryAutoTruncate unit tests

To test:
1 - Apply just this patch - should fail
2 - Apply the other patch - should pass

https://bugs.koha-community.org/show_bug.cgi?id=18347
Comment 6 Nick Clemens 2017-04-06 19:45:46 UTC Comment hidden (obsolete)
Comment 7 Nick Clemens 2017-04-08 03:44:37 UTC
Created attachment 61983 [details] [review]
Bug 18374 - Respect QueryAutoTruncate syspref in Elasticsearch

This patchset adds a subroutine '_truncate_terms' to the ES QueryParser.

If QueryAutoTruncate is enabled this function will be called for any
search to add wildcard '*' to all terms

To test:
1 - Enable Elasticsearch and have some records indexed
2 - Search for partial terms
3 - Note they fail unless '*' is appended
4 - Apply patch, leave QueryAutoTruncate disabled
5 - Note partial term searches still fail
6 - Enable QueryAutoTruncate
7 - Note partial term searches succeed
8 - Do some regular and advanced searches to make sure results are as
expected

https://bugs.koha-community.org/show_bug.cgi?id=18347
Comment 8 Jonathan Druart 2017-04-11 20:05:28 UTC
    #   Failed test at t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t line 112.
    #          got: 'donald duck'
    #     expected: 'donald* duck*'

    #   Failed test at t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t line 114.
    #          got: 'donald or duck and mickey not mouse'
    #     expected: 'donald* or duck* and mickey* not mouse*'
Comment 9 Nick Clemens 2017-07-07 10:37:51 UTC
Created attachment 64903 [details] [review]
Bug 18374 - QueryAutoTruncate unit tests

To test:
1 - Apply just this patch - should fail
2 - Apply the other patch - should pass

https://bugs.koha-community.org/show_bug.cgi?id=18347
Comment 10 Nick Clemens 2017-07-07 10:37:54 UTC
Created attachment 64904 [details] [review]
Bug 18374 - Respect QueryAutoTruncate syspref in Elasticsearch

This patchset adds a subroutine '_truncate_terms' to the ES QueryParser.

If QueryAutoTruncate is enabled this function will be called for any
search to add wildcard '*' to all terms

To test:
1 - Enable Elasticsearch and have some records indexed
2 - Search for partial terms
3 - Note they fail unless '*' is appended
4 - Apply patch, leave QueryAutoTruncate disabled
5 - Note partial term searches still fail
6 - Enable QueryAutoTruncate
7 - Note partial term searches succeed
8 - Do some regular and advanced searches to make sure results are as
expected

https://bugs.koha-community.org/show_bug.cgi?id=18347
Comment 11 Tomás Cohen Arazi 2017-09-12 15:17:41 UTC
Created attachment 67098 [details] [review]
Bug 18374: QueryAutoTruncate unit tests

To test:
1 - Apply just this patch - should fail
2 - Apply the other patch - should pass

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 12 Tomás Cohen Arazi 2017-09-12 15:17:49 UTC
Created attachment 67099 [details] [review]
Bug 18374: Respect QueryAutoTruncate syspref in Elasticsearch

This patchset adds a subroutine '_truncate_terms' to the ES QueryParser.

If QueryAutoTruncate is enabled this function will be called for any
search to add wildcard '*' to all terms

To test:
1 - Enable Elasticsearch and have some records indexed
2 - Search for partial terms
3 - Note they fail unless '*' is appended
4 - Apply patch, leave QueryAutoTruncate disabled
5 - Note partial term searches still fail
6 - Enable QueryAutoTruncate
7 - Note partial term searches succeed
8 - Do some regular and advanced searches to make sure results are as
expected

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 13 Tomás Cohen Arazi 2017-09-12 15:17:56 UTC
Created attachment 67100 [details] [review]
Bug 18374: (QA followup) Remove warning in Elasticsearch/Search.pm

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>