Bug 27307 - "Keyword as phrase" option in search dropdown doesn't work with Elastic
Summary: "Keyword as phrase" option in search dropdown doesn't work with Elastic
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-24 13:29 UTC by Andrew Fuerste-Henry
Modified: 2021-02-11 22:11 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.02,20.05.09


Attachments
Bug 27307: Unit test (1.33 KB, patch)
2020-12-24 14:08 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 27307: Don't drop phrase directive when searching keyword index (1.45 KB, patch)
2020-12-24 14:08 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 27307: Unit test (1.39 KB, patch)
2020-12-24 15:33 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 27307: Don't drop phrase directive when searching keyword index (1.51 KB, patch)
2020-12-24 15:33 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 27307: Unit test (1.45 KB, patch)
2021-01-12 12:14 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 27307: Don't drop phrase directive when searching keyword index (1.58 KB, patch)
2021-01-12 12:14 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2020-12-24 13:29:58 UTC
When using Elastic, selecting "Keyword as phrase" from the search dropdown does not properly perform a phrase search. Other "as phrase" options work correctly.
Comment 1 Nick Clemens 2020-12-24 14:08:45 UTC
Created attachment 114699 [details] [review]
Bug 27307: Unit test
Comment 2 Nick Clemens 2020-12-24 14:08:48 UTC
Created attachment 114700 [details] [review]
Bug 27307: Don't drop phrase directive when searching keyword index

We convert 'keyword' to '' as an index since we want it to search all fields

When we are searching 'as phrase', however, we should not drop the search type

To test:
 1 - Enable IntranetCatalogPullDown
 2 - Set searchEngine to Elasticsearch
 3 - Perform a search for 'Keyword as phrase' for a phrase that does appear in a record
 4 - You get the result
 5 - Reverse the order of words in the phrase
 6 - You still get a result?
 7 - Apply patch
 8 - Restart all the things
 9 - Reversed search does not return record
10 - Correct order and search, correct record returned
Comment 3 Andrew Fuerste-Henry 2020-12-24 15:33:31 UTC
Created attachment 114701 [details] [review]
Bug 27307: Unit test

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 4 Andrew Fuerste-Henry 2020-12-24 15:33:34 UTC
Created attachment 114702 [details] [review]
Bug 27307: Don't drop phrase directive when searching keyword index

We convert 'keyword' to '' as an index since we want it to search all fields

When we are searching 'as phrase', however, we should not drop the search type

To test:
 1 - Enable IntranetCatalogPullDown
 2 - Set searchEngine to Elasticsearch
 3 - Perform a search for 'Keyword as phrase' for a phrase that does appear in a record
 4 - You get the result
 5 - Reverse the order of words in the phrase
 6 - You still get a result?
 7 - Apply patch
 8 - Restart all the things
 9 - Reversed search does not return record
10 - Correct order and search, correct record returned

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 5 Martin Renvoize 2021-01-12 12:14:48 UTC
Created attachment 115077 [details] [review]
Bug 27307: Unit test

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2021-01-12 12:14:52 UTC
Created attachment 115078 [details] [review]
Bug 27307: Don't drop phrase directive when searching keyword index

We convert 'keyword' to '' as an index since we want it to search all fields

When we are searching 'as phrase', however, we should not drop the search type

To test:
 1 - Enable IntranetCatalogPullDown
 2 - Set searchEngine to Elasticsearch
 3 - Perform a search for 'Keyword as phrase' for a phrase that does appear in a record
 4 - You get the result
 5 - Reverse the order of words in the phrase
 6 - You still get a result?
 7 - Apply patch
 8 - Restart all the things
 9 - Reversed search does not return record
10 - Correct order and search, correct record returned

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2021-01-12 12:15:57 UTC
Works well, includes tests..

Passing QA
Comment 8 Jonathan Druart 2021-01-12 15:48:27 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 9 Fridolin Somers 2021-01-18 14:33:34 UTC
Pushed to 20.11.x for 20.11.02
Comment 10 Andrew Fuerste-Henry 2021-01-29 14:33:33 UTC
Pushed to 20.05.x for 20.05.09
Comment 11 Andrew Fuerste-Henry 2021-01-29 14:34:31 UTC
Pushed to 20.05.x for 20.05.09
Comment 12 Victor Grousset/tuxayo 2021-02-01 17:36:02 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.