Bug 24567 - Elasticsearch: CCL syntax does not allow for multiple indexes to be searched at once
Summary: Elasticsearch: CCL syntax does not allow for multiple indexes to be searched ...
Status: Pushed to master
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:
: 25263 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-02-03 14:47 UTC by Nick Clemens
Modified: 2020-11-04 16:33 UTC (History)
5 users (show)

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


Attachments
Bug 24567: Don't strip spaces along with dangling colons (3.04 KB, patch)
2020-10-27 11:31 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 24567: Don't strip spaces along with dangling colons (3.17 KB, patch)
2020-10-27 12:30 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 24567: (follow-up) Use dollar sign to refer to captures (906 bytes, patch)
2020-11-02 13:44 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 24567: Don't strip spaces along with dangling colons (3.25 KB, patch)
2020-11-03 09:54 UTC, Joonas Kylmälä
Details | Diff | Splinter Review
Bug 24567: (follow-up) Use dollar sign to refer to captures (1.03 KB, patch)
2020-11-03 09:54 UTC, Joonas Kylmälä
Details | Diff | Splinter Review
Bug 24567: (QA follow-up) Remove warning in regex (1.36 KB, patch)
2020-11-03 10:35 UTC, Joonas Kylmälä
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2020-02-03 14:47:00 UTC
A search like:
ti:glory and au:clinton

should return results with glory in the title and clinton in the author, this works in Zebra but does not work in ES currently
Comment 1 Nick Clemens 2020-02-26 02:41:04 UTC
AND must be capitalized, but otherwise not sure what I found here, seems to be working
Comment 2 Nick Clemens 2020-02-26 15:53:44 UTC
Ah, a search like:
ti:chess AND kw:chess

does fail, because it translates to:
ti:chess ANDchess
Comment 3 Nick Clemens 2020-10-27 11:31:36 UTC
Created attachment 112562 [details] [review]
Bug 24567: Don't strip spaces along with dangling colons

This updates the regex used for removing colons to capture those with space on either side, and remove the colon
while preserving the space

To test:
 1 - Have Koha using ES
 2 - Search for:
    ti:chess AND chess
 3 - You should get a result in sample data, otherwise replace 'chess' with a title in your catalogue
 4 - Search for:
    ti:chess AND kw:chess
 5 - No result
 6 - Enable  DumpTemplateVarsIntranet  and  DumpSearchQueryTemplate
 7 - Repeate search and check page source
 8 - search_query has:
    title:chess ANDchess
 9 - Apply patch
10 - Repeat
11 - Seaerch works!
12 - query is now:
     title:chess AND chess
Comment 4 Séverine Queune 2020-10-27 12:30:09 UTC
Created attachment 112564 [details] [review]
Bug 24567: Don't strip spaces along with dangling colons

This updates the regex used for removing colons to capture those with space on either side, and remove the colon
while preserving the space

To test:
 1 - Have Koha using ES
 2 - Search for:
    ti:chess AND chess
 3 - You should get a result in sample data, otherwise replace 'chess' with a title in your catalogue
 4 - Search for:
    ti:chess AND kw:chess
 5 - No result
 6 - Enable  DumpTemplateVarsIntranet  and  DumpSearchQueryTemplate
 7 - Repeate search and check page source
 8 - search_query has:
    title:chess ANDchess
 9 - Apply patch
10 - Repeat
11 - Seaerch works!
12 - query is now:
     title:chess AND chess

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 5 Katrin Fischer 2020-11-01 13:18:52 UTC
 FAIL	Koha/SearchEngine/Elasticsearch/QueryBuilder.pm
   OK	  critic
   OK	  forbidden patterns
   OK	  git manipulation
   OK	  pod
   OK	  pod coverage
   OK	  spelling
   FAIL	  valid
		\3 better written as $3 
		\4 better written as $4 

Can you please check?
Comment 6 Nick Clemens 2020-11-02 13:44:38 UTC
Created attachment 112832 [details] [review]
Bug 24567: (follow-up) Use dollar sign to refer to captures
Comment 7 Joonas Kylmälä 2020-11-03 09:54:44 UTC
Created attachment 112903 [details] [review]
Bug 24567: Don't strip spaces along with dangling colons

This updates the regex used for removing colons to capture those with space on either side, and remove the colon
while preserving the space

To test:
 1 - Have Koha using ES
 2 - Search for:
    ti:chess AND chess
 3 - You should get a result in sample data, otherwise replace 'chess' with a title in your catalogue
 4 - Search for:
    ti:chess AND kw:chess
 5 - No result
 6 - Enable  DumpTemplateVarsIntranet  and  DumpSearchQueryTemplate
 7 - Repeate search and check page source
 8 - search_query has:
    title:chess ANDchess
 9 - Apply patch
10 - Repeat
11 - Seaerch works!
12 - query is now:
     title:chess AND chess

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Comment 8 Joonas Kylmälä 2020-11-03 09:54:47 UTC
Created attachment 112904 [details] [review]
Bug 24567: (follow-up) Use dollar sign to refer to captures

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Comment 9 Joonas Kylmälä 2020-11-03 09:58:11 UTC
I only now noticed the warning

> Use of uninitialized value $3 in concatenation (.) or string at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm line 943.

Moving back to FQA until sure what to do with this.
Comment 10 Joonas Kylmälä 2020-11-03 10:35:56 UTC
Created attachment 112906 [details] [review]
Bug 24567: (QA follow-up) Remove warning in regex

Without this patch we get

Use of uninitialized value $3 in concatenation (.) or string at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm line 943.

This converts the | OR operator to two different regexes so that the
capture group variables will be defined in every case.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Comment 11 Joonas Kylmälä 2020-11-03 10:36:40 UTC
Added follow-up to remove the warning. Passing QA.
Comment 12 Nick Clemens 2020-11-04 16:07:42 UTC
*** Bug 25263 has been marked as a duplicate of this bug. ***
Comment 13 Jonathan Druart 2020-11-04 16:33:52 UTC
Pushed to master for 20.11, thanks to everybody involved!