Bug 22426 - Elasticsearch - Index location is missing in advanced search
Summary: Elasticsearch - Index location is missing in advanced search
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Bouzid Fergani
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-27 17:21 UTC by Marjorie Barry-Vila
Modified: 2019-10-02 08:01 UTC (History)
7 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:


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

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>