Bug 22295 - Elasticsearch - Advanced search should group terms entered in a single input
Summary: Elasticsearch - Advanced search should group terms entered in a single input
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Ere Maijala
QA Contact: Josef Moravec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-08 14:18 UTC by Nick Clemens
Modified: 2020-06-04 20:33 UTC (History)
10 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.05.00, 18.11.05


Attachments
Bug 22295: Make Elasticsearch query builder group multi-term queries (3.48 KB, patch)
2019-03-08 11:28 UTC, Ere Maijala
Details | Diff | Splinter Review
Bug 19380: Add transfer informations in ILS-DI GetRecords response (4.63 KB, patch)
2019-04-03 14:35 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 19380: Use Koha::Item::get_transfer instead of GetTransfers (4.78 KB, patch)
2019-04-03 14:35 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22295: Make Elasticsearch query builder group multi-term queries (3.58 KB, patch)
2019-04-03 14:35 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 22295: Make Elasticsearch query builder group multi-term queries (3.59 KB, patch)
2019-04-03 15:42 UTC, Josef Moravec
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2019-02-08 14:18:02 UTC
This seems to be a difference in how Zebra and ES operate

In Zebra a search like:
ti:cats dogs
will search for records with both 'cats' and 'dogs' in the title

In ES the same search is treated as
ti:cats _all:dogs
because spaces end an index

To perform the same search as Zebra, ES expects:
ti:(cats dogs)

For searching from the simple search bar this seems to be an issue of learning syntax. When using the advanced search, however, I would expect that two terms entered into a single box would both apply to the selected dropdown

To recreate:
1 - Find two records 
  - in the first add the words kangaroo and bucket to the title
  - in the second add kangaroo to title and bucket to publisher name
2 - in the search box try:
  - ti:kangaroo bucket - both titles returned
  - ti:bucket kangaroo - only first is returned
  - ti:(kangaroo bucket) - only first is returned
  - ti:(bucket kangaroo) - only first is returned
3 - From advanced search set an input dropdown to 'title'
  - bucket kangaroo - returns only the first
  - kangaroo bucket - returns both
  - (bucket kangaroo) - returns only the first
  - (kangaroo bucket) - returns only the first

The parens in 3 reflect the expected behaviour (i think) and should be added by default
Comment 1 Ere Maijala 2019-03-08 11:28:16 UTC
Created attachment 86370 [details] [review]
Bug 22295: Make Elasticsearch query builder group multi-term queries

Test plan:

1. Do an advanced search for
Title = new
AND
Title = york
2. Verify that the results match an advanced search for:
Title = new york
3. Verify that tests in t/db_dependent/Koha/SearchEngine/Elasticsearch still pass
Comment 2 Michal Denar 2019-04-03 14:35:35 UTC
Created attachment 87359 [details] [review]
Bug 19380: Add transfer informations in ILS-DI GetRecords response

Test plan:
1. Put an item into a 'transfer' state
  a. Place a hold on an item in branch A for a patron of branch B
  b. Check in this item in branch A and confirm transfer
2. Go to http://opac/cgi-bin/koha/ilsdi.pl?service=GetRecords&id=XXX
   where XXX is the biblionumber of the biblio the item belongs to.
3. Verify you have a new <transfer> element inside //record/items/item
   that contains <datesent>, <frombranch> and <tobranch>
4. Check in the same item in branch B, so that the item is not flagged
   as being transferred
5. Repeat 2
6. Verify that the <transfer> element is not there.
7. prove t/db_dependent/ILSDI_Services.t

Followed test plan, patch worked as described. Also ran QA test tools
and modified files passed

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 3 Michal Denar 2019-04-03 14:35:38 UTC
Created attachment 87360 [details] [review]
Bug 19380: Use Koha::Item::get_transfer instead of GetTransfers

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 4 Michal Denar 2019-04-03 14:35:43 UTC
Created attachment 87361 [details] [review]
Bug 22295: Make Elasticsearch query builder group multi-term queries

Test plan:

1. Do an advanced search for
Title = new
AND
Title = york
2. Verify that the results match an advanced search for:
Title = new york
3. Verify that tests in t/db_dependent/Koha/SearchEngine/Elasticsearch still pass

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 5 Josef Moravec 2019-04-03 15:42:44 UTC
Created attachment 87368 [details] [review]
Bug 22295: Make Elasticsearch query builder group multi-term queries

Test plan:

1. Do an advanced search for
Title = new
AND
Title = york
2. Verify that the results match an advanced search for:
Title = new york
3. Verify that tests in t/db_dependent/Koha/SearchEngine/Elasticsearch still pass

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 6 Nick Clemens 2019-04-10 20:13:22 UTC
Awesome work all!

Pushed to master for 19.05
Comment 7 Martin Renvoize 2019-04-15 11:30:33 UTC
Pushed to 18.11.x for 18.11.05
Comment 8 Lucas Gass 2019-04-16 20:24:52 UTC
not backporting ES bug fixes to the 18.05.x series