Bug 22426 - Elasticsearch - Index location is missing in advanced search
Summary: Elasticsearch - Index location is missing in advanced search
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: Fridolin SOMERS
QA Contact:
URL:
Keywords:
: 24109 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-02-27 17:21 UTC by Marjorie Barry-Vila
Modified: 2020-06-04 20:37 UTC (History)
11 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.03


Attachments
Bug 22426: Elasticsearch - Index location is missing in advanced search (961 bytes, patch)
2019-05-06 17:39 UTC, Bouzid Fergani
Details | Diff | Splinter Review
Bug 22426: (alternate) Elasticsearch fix location limit in advanced search (1.45 KB, patch)
2019-06-17 14:18 UTC, Fridolin SOMERS
Details | Diff | Splinter Review
Bug 22426: Elasticsearch - Index location is missing in advanced search (1.08 KB, patch)
2019-10-02 08:01 UTC, sandboxes@biblibre.com
Details | Diff | Splinter Review
Bug 22426: (alternate) Elasticsearch fix location limit in advanced search (1.65 KB, patch)
2019-10-02 08:01 UTC, sandboxes@biblibre.com
Details | Diff | Splinter Review
Bug 22426: (alternate) Elasticsearch fix location limit in advanced search (1.72 KB, patch)
2020-01-10 14:19 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22426: Map 'loc' to 'location' when building ES queries (1.71 KB, patch)
2020-01-10 14:20 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marjorie Barry-Vila 2019-02-27 17:21:32 UTC
Hi,

A search made on Shelving location tab in advanced search gives 0 result.

Test plan :
- in advanced search, choose a location in shelving location tab and start search (opac-search.pl?idx=kw&op=and&idx=kw&op=and&idx=kw&do=Search&limit=mc-loc)
- 0 result
- check that location exist by doing a simple search and filtering on the location facet
- have some results

I think problem is index "loc" is used in advanced search or it could be index "location" like facet.

Or is it a configuration problem?

Regards
Marjorie
Comment 1 Bouzid Fergani 2019-05-06 17:39:48 UTC
Created attachment 89378 [details] [review]
Bug 22426: Elasticsearch - Index location is missing in advanced search
Comment 2 Michal Denar 2019-05-06 21:05:30 UTC
Any test plan?
Comment 3 Bouzid Fergani 2019-05-07 12:41:25 UTC
Test plan :
Without patch:
    - in advanced search, choose a location in shelving location tab and start search (opac-search.pl?idx=kw&op=and&idx=kw&op=and&idx=kw&do=Search&limit=mc-loc)
    - 0 result
    - check that location exist by doing a simple search and filtering on the    location facet
    - have some results

With patch:
     
    - in advanced search, choose a location in shelving location tab and start search (opac-search.pl?idx=kw&op=and&idx=kw&op=and&idx=kw&do=Search&limit=mc-loc)
    - found results
Thanks.
Comment 4 Michal Denar 2019-05-07 19:38:30 UTC
Sorry, but link from test plan gives me:

No results found!

You did not specify any search criteria.
Error:
Unable to perform your search. Please try again. 

I tried reindex ES, but same result.

Link from working search looks like:
cgi-bin/koha/opac-search.pl?advsearch=1&idx=kw&q=a&idx=kw&idx=kw&limit=branch%3ACPL&limit=available&sort_by=relevance&do=Search
Comment 5 Marjorie Barry-Vila 2019-05-13 15:45:42 UTC
(In reply to Michal Denar from comment #4)
> Sorry, but link from test plan gives me:
> 
> No results found!
> 
> You did not specify any search criteria.
> Error:
> Unable to perform your search. Please try again. 
> 
> I tried reindex ES, but same result.
> 
> Link from working search looks like:
> cgi-bin/koha/opac-search.
> pl?advsearch=1&idx=kw&q=a&idx=kw&idx=kw&limit=branch%3ACPL&limit=available&so
> rt_by=relevance&do=Search

Hi Michal,


In your url I see the limitation by branch (limit=branch%3ACPL) but not on a location (mc-loc)
The patch is to solve the problem of searching on the index location.

You should have a result of type opac-search.pl?idx=kw&op=and&idx=kw&op=and&idx=kw&do=Search&limit=mc-loc


Regards,
Marjorie
Comment 6 Fridolin SOMERS 2019-06-17 14:12:48 UTC
I see that there is a removal of "mc-" before index to field convertion : 

Added by commit : 
Bug 12478: fix multi-choice stuff in advanced search

In Koha/SearchEngine/Elasticsearch/QueryBuilder.pm :
        my $mc = '';
        if ($f =~ /^mc-/) {
            $mc = 'mc-';
            $f =~ s/^mc-//;
        }

And in %index_field_convert there is :
'mc-loc' => 'location'

So I think adding loc => location should fix the problem.
That is why there is no problem with mc-ccode and mc-itemtype.
Comment 7 Fridolin SOMERS 2019-06-17 14:18:33 UTC
Created attachment 90670 [details] [review]
Bug 22426: (alternate) Elasticsearch fix location limit in advanced search

A search made on Shelving location tab in advanced search gives 0 result.

Test plan :
Without patch:
    - in advanced search, choose a location in shelving location tab and start search (opac-search.pl?idx=kw&op=and&idx=kw&op=and&idx=kw&do=Search&limit=mc-loc)
    - 0 result
    - check that location exist by doing a simple search and filtering on the    location facet
    - have some results
With patch:
    - in advanced search, choose a location in shelving location tab and start search (opac-search.pl?idx=kw&op=and&idx=kw&op=and&idx=kw&do=Search&limit=mc-loc)
    - found results
Comment 8 Fridolin SOMERS 2019-06-17 14:19:55 UTC
Here is my alternate patch.
Don't hesitate to discuss it.
Kind regards ;)
Comment 9 sandboxes@biblibre.com 2019-10-02 08:01:11 UTC
Patch tested with a sandbox, by Séverine QUEUNE <severine.queune@bulac.fr>
Comment 10 sandboxes@biblibre.com 2019-10-02 08:01:44 UTC
Created attachment 93397 [details] [review]
Bug 22426: Elasticsearch - Index location is missing in advanced search

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 11 sandboxes@biblibre.com 2019-10-02 08:01:48 UTC
Created attachment 93398 [details] [review]
Bug 22426: (alternate) Elasticsearch fix location limit in advanced search

A search made on Shelving location tab in advanced search gives 0 result.

Test plan :
Without patch:
    - in advanced search, choose a location in shelving location tab and start search (opac-search.pl?idx=kw&op=and&idx=kw&op=and&idx=kw&do=Search&limit=mc-loc)
    - 0 result
    - check that location exist by doing a simple search and filtering on the    location facet
    - have some results
With patch:
    - in advanced search, choose a location in shelving location tab and start search (opac-search.pl?idx=kw&op=and&idx=kw&op=and&idx=kw&do=Search&limit=mc-loc)
    - found results

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 12 Jonathan Druart 2019-12-05 11:48:59 UTC
I am not sure which is the best fix here.
Comment 13 Nick Clemens 2020-01-10 14:13:57 UTC
*** Bug 24109 has been marked as a duplicate of this bug. ***
Comment 14 Nick Clemens 2020-01-10 14:14:54 UTC
The alternate patch would be my preference - the first treats mc-loc as a special case, I think it fits more to add it to the map like other mc-fields are
Comment 15 Jonathan Druart 2020-01-10 14:19:37 UTC
Created attachment 97223 [details] [review]
Bug 22426: (alternate) Elasticsearch fix location limit in advanced search

A search made on Shelving location tab in advanced search gives 0 result.

Test plan :
Without patch:
    - in advanced search, choose a location in shelving location tab and start search (opac-search.pl?idx=kw&op=and&idx=kw&op=and&idx=kw&do=Search&limit=mc-loc)
    - 0 result
    - check that location exist by doing a simple search and filtering on the    location facet
    - have some results
With patch:
    - in advanced search, choose a location in shelving location tab and start search (opac-search.pl?idx=kw&op=and&idx=kw&op=and&idx=kw&do=Search&limit=mc-loc)
    - found results

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 16 Jonathan Druart 2020-01-10 14:20:25 UTC
Created attachment 97224 [details] [review]
Bug 22426: Map 'loc' to 'location' when building ES queries

A search made on Shelving location tab in advanced search gives 0 result.

Test plan :
Without patch:
    - in advanced search, choose a location in shelving location tab and start search (opac-search.pl?idx=kw&op=and&idx=kw&op=and&idx=kw&do=Search&limit=mc-loc)
    - 0 result
    - check that location exist by doing a simple search and filtering on the    location facet
    - have some results
With patch:
    - in advanced search, choose a location in shelving location tab and start search (opac-search.pl?idx=kw&op=and&idx=kw&op=and&idx=kw&do=Search&limit=mc-loc)
    - found results

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 17 Martin Renvoize 2020-01-10 16:23:28 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 18 Joy Nelson 2020-01-31 00:20:44 UTC
Pushed to 19.11.x branch for 19.11.03