Bug 27724 - Use lenient also in Elasticsearch authorities search
Summary: Use lenient also in Elasticsearch authorities search
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Fridolin Somers
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-18 14:28 UTC by Fridolin Somers
Modified: 2021-12-13 21:10 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.06,20.05.12


Attachments
Bug 27724: Use lenient also in Elasticsearch authorities search (2.29 KB, patch)
2021-02-18 14:50 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 27724: Add unit test (1.27 KB, patch)
2021-02-18 14:54 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 27724: Use lenient also in Elasticsearch authorities search (2.29 KB, patch)
2021-02-18 14:55 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 27724: Use lenient also in Elasticsearch authorities search (2.44 KB, patch)
2021-04-01 07:46 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 27724: Add unit test (1.42 KB, patch)
2021-04-01 08:49 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 27724: Use lenient also in Elasticsearch authorities search (2.44 KB, patch)
2021-04-01 08:49 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 27724: Add unit test (1.48 KB, patch)
2021-05-15 06:00 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 27724: Use lenient also in Elasticsearch authorities search (2.49 KB, patch)
2021-05-15 06:00 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 27724: Add unit test (1.54 KB, patch)
2021-05-17 13:11 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 27724: Use lenient also in Elasticsearch authorities search (2.55 KB, patch)
2021-05-17 13:11 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 Fridolin Somers 2021-02-18 14:28:04 UTC
In Elasticsearch, query for biblios uses lenient=true.
This is also needed for authorities search.
In case a search field is defined as type interger.
Comment 1 Fridolin Somers 2021-02-18 14:50:33 UTC
Created attachment 116991 [details] [review]
Bug 27724: Use lenient also in Elasticsearch authorities search

In Elasticsearch, query for biblios uses lenient=true.
This is also needed for authorities search.
In case a search field is defined as type numeric.

Test plan :
1) Use Elasticsearch searchengine
2) Define a search field 'local-number' as type 'Number'
3) Be sure to us 'local-number' in autorities mapping
4) Rebuild autorities
5) Performe a search for autorities with 'Search entire record' and
   'contains' with term '123'
=> Without patch you get error :
[query_shard_exception] Can only use prefix queries on keyword and text fields - not on [local-number] which is of type [integer]
Comment 2 Fridolin Somers 2021-02-18 14:54:48 UTC
Created attachment 116996 [details] [review]
Bug 27724: Add unit test

Run t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t
Comment 3 Fridolin Somers 2021-02-18 14:55:04 UTC
Created attachment 116997 [details] [review]
Bug 27724: Use lenient also in Elasticsearch authorities search

In Elasticsearch, query for biblios uses lenient=true.
This is also needed for authorities search.
In case a search field is defined as type numeric.

Test plan :
1) Use Elasticsearch searchengine
2) Define a search field 'local-number' as type 'Number'
3) Be sure to us 'local-number' in autorities mapping
4) Rebuild autorities
5) Performe a search for autorities with 'Search entire record' and
   'contains' with term '123'
=> Without patch you get error :
[query_shard_exception] Can only use prefix queries on keyword and text fields - not on [local-number] which is of type [integer]
Comment 4 Séverine Queune 2021-04-01 07:46:09 UTC
Created attachment 119062 [details] [review]
Bug 27724: Use lenient also in Elasticsearch authorities search

In Elasticsearch, query for biblios uses lenient=true.
This is also needed for authorities search.
In case a search field is defined as type numeric.

Test plan :
1) Use Elasticsearch searchengine
2) Define a search field 'local-number' as type 'Number'
3) Be sure to us 'local-number' in autorities mapping
4) Rebuild autorities
5) Performe a search for autorities with 'Search entire record' and
   'contains' with term '123'
=> Without patch you get error :
[query_shard_exception] Can only use prefix queries on keyword and text fields - not on [local-number] which is of type [integer]

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 5 Séverine Queune 2021-04-01 08:47:56 UTC
Sorry, I missed the first patch during the signoff, I correct that in a second !
Comment 6 Séverine Queune 2021-04-01 08:49:21 UTC
Created attachment 119066 [details] [review]
Bug 27724: Add unit test

Run t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 7 Séverine Queune 2021-04-01 08:49:24 UTC
Created attachment 119067 [details] [review]
Bug 27724: Use lenient also in Elasticsearch authorities search

In Elasticsearch, query for biblios uses lenient=true.
This is also needed for authorities search.
In case a search field is defined as type numeric.

Test plan :
1) Use Elasticsearch searchengine
2) Define a search field 'local-number' as type 'Number'
3) Be sure to us 'local-number' in autorities mapping
4) Rebuild autorities
5) Performe a search for autorities with 'Search entire record' and
   'contains' with term '123'
=> Without patch you get error :
[query_shard_exception] Can only use prefix queries on keyword and text fields - not on [local-number] which is of type [integer]

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 8 Victor Grousset/tuxayo 2021-05-15 06:00:20 UTC
Created attachment 121002 [details] [review]
Bug 27724: Add unit test

Run t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 9 Victor Grousset/tuxayo 2021-05-15 06:00:24 UTC
Created attachment 121003 [details] [review]
Bug 27724: Use lenient also in Elasticsearch authorities search

In Elasticsearch, query for biblios uses lenient=true.
This is also needed for authorities search.
In case a search field is defined as type numeric.

Test plan :
1) Use Elasticsearch searchengine
2) Define a search field 'local-number' as type 'Number'
3) Be sure to us 'local-number' in autorities mapping
4) Rebuild autorities
5) Performe a search for autorities with 'Search entire record' and
   'contains' with term '123'
=> Without patch you get error :
[query_shard_exception] Can only use prefix queries on keyword and text fields - not on [local-number] which is of type [integer]

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 10 Victor Grousset/tuxayo 2021-05-15 06:02:33 UTC
As a step towards QA, here is another signoff.
Comment 11 Martin Renvoize 2021-05-17 13:11:37 UTC
Created attachment 121041 [details] [review]
Bug 27724: Add unit test

Run t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 12 Martin Renvoize 2021-05-17 13:11:41 UTC
Created attachment 121042 [details] [review]
Bug 27724: Use lenient also in Elasticsearch authorities search

In Elasticsearch, query for biblios uses lenient=true.
This is also needed for authorities search.
In case a search field is defined as type numeric.

Test plan :
1) Use Elasticsearch searchengine
2) Define a search field 'local-number' as type 'Number'
3) Be sure to us 'local-number' in autorities mapping
4) Rebuild autorities
5) Performe a search for autorities with 'Search entire record' and
   'contains' with term '123'
=> Without patch you get error :
[query_shard_exception] Can only use prefix queries on keyword and text fields - not on [local-number] which is of type [integer]

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 13 Martin Renvoize 2021-05-17 13:12:44 UTC
Logically this makes sense to me.. works as described and includes expected tests.. 

Passing QA
Comment 14 Jonathan Druart 2021-05-19 13:08:01 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 15 Fridolin Somers 2021-05-20 12:49:14 UTC
Pushed to 20.11.x for 20.11.06
Comment 16 Andrew Fuerste-Henry 2021-05-25 14:05:59 UTC
Pushed to 20.05.x for 20.05.12
Comment 17 Victor Grousset/tuxayo 2021-05-25 14:52:49 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.