Story #15781

[WB2] Support multiple values for a given property key

Added by Tom Morris 4 months ago. Updated 4 days ago.

Status:
In Progress
Priority:
Normal
Assigned To:
Category:
Workbench2
Start date:
01/30/2020
Due date:
% Done:

0%

Estimated time:
(Total: 0.00 h)
Story points:
4.0
Release relationship:
Auto

Description

Backend

https://www.postgresql.org/docs/9.5/functions-json.html

arvados_development=# select '{"a":["foo","bar"]}'::jsonb @> '{"a":["bar"]}'::jsonb;
 ?column? 
----------
 t

So jsonb subset match works if you know the key and are looking for an exact match on the value.

It looks like an Arvados filter of [["properties.a", "=", ["bar"]] might already work by since it uses @> in the implementation. Although that's arguably a bug since the expectation is to get an exact match. Instead we'll introduce a new operator [["properties.a", "contains", "bar"].

Frontend UI

For editing, rather than overwriting a tag:value pair as is done currently when the tag is specified multiple times, add the new tag:value pair to the list. When writing to the backend, merge the values into an array which becomes value that's written into the properties. Arrays are only used when there are multiple values.

For searching the implementation will use the new contains operator internally, but continue to use the "has" notation externally.


Subtasks

Arvados - Task #16030: Review 15781-multi-value-property-search (backend, arvados repo)In ProgressPeter Amstutz

Task #16112: Review 15781-multi-value-property-edit (wb2 repo)In ProgressPeter Amstutz


Related issues

Has duplicate Arvados Workbench 2 - Bug #15774: Advanced Search editor keeps adding search terms instead of replacingDuplicate

History

#1 Updated by Peter Amstutz 4 months ago

  • Description updated (diff)

#2 Updated by Peter Amstutz 4 months ago

  • Description updated (diff)

#3 Updated by Peter Amstutz 4 months ago

  • Description updated (diff)

#4 Updated by Peter Amstutz 4 months ago

  • Description updated (diff)

#5 Updated by Tom Morris 3 months ago

  • Description updated (diff)
  • Target version changed from To Be Groomed to Arvados Future Sprints
  • Story points set to 4.0

#6 Updated by Peter Amstutz about 2 months ago

  • Release set to 20
  • Target version deleted (Arvados Future Sprints)

#7 Updated by Lucas Di Pentima about 1 month ago

  • Target version set to 2020-01-29 Sprint
  • Assigned To set to Lucas Di Pentima
  • Category set to Workbench2

#8 Updated by Lucas Di Pentima 24 days ago

  • Status changed from New to In Progress

#9 Updated by Lucas Di Pentima 20 days ago

  • Target version changed from 2020-01-29 Sprint to 2020-02-12 Sprint

#10 Updated by Lucas Di Pentima 19 days ago

Updates at commit:8a88ceb33 - branch 15781-multi-value-property-search (arvados repo)
Test run: https://ci.arvados.org/job/developer-run-tests/1711/

  • Adds contains subproperty filter to the API server
  • Adds tests checking that the new operator works on scalar and array subproperty values and also that the = filter doesn't work on array subproperty elements.
  • Adds documentation update.

#11 Updated by Lucas Di Pentima 15 days ago

Updates for workbench2 at commit 41658ace - branch 15781-multi-value-property-edit

  • Adds support for multi-value properties editing on collections and projects
  • Adds support for multi-value properties on the advanced search editor
  • Uses 'contains' filter when searching for properties

#12 Updated by Lucas Di Pentima 14 days ago

  • Has duplicate Bug #15774: Advanced Search editor keeps adding search terms instead of replacing added

#13 Updated by Peter Amstutz 7 days ago

Lucas Di Pentima wrote:

Updates at commit:8a88ceb33 - branch 15781-multi-value-property-search (arvados repo)
Test run: https://ci.arvados.org/job/developer-run-tests/1711/

  • Adds contains subproperty filter to the API server
  • Adds tests checking that the new operator works on scalar and array subproperty values and also that the = filter doesn't work on array subproperty elements.
  • Adds documentation update.

The documentation for "contains" operation is not very clear. Suggest something like:

Filter where subproperty has a value either by exact match or value is element of subproperty list. For example, ["foo", "containes", "bar"] will find both {"foo": "bar"} and {"foo": ["bar", "baz"]}.

#14 Updated by Lucas Di Pentima 7 days ago

Peter Amstutz wrote:

Lucas Di Pentima wrote:

Updates at commit:8a88ceb33 - branch 15781-multi-value-property-search (arvados repo)

[...]

The documentation for "contains" operation is not very clear. Suggest something like:

Filter where subproperty has a value either by exact match or value is element of subproperty list. For example, ["foo", "containes", "bar"] will find both {"foo": "bar"} and {"foo": ["bar", "baz"]}.

Fixed at commit:dd7da09fe

#15 Updated by Peter Amstutz 7 days ago

Lucas Di Pentima wrote:

Updates for workbench2 at commit 41658ace - branch 15781-multi-value-property-edit

  • Adds support for multi-value properties editing on collections and projects
  • Adds support for multi-value properties on the advanced search editor
  • Uses 'contains' filter when searching for properties

In the advanced search popup, removing property filters doesn't remove them from the query bar.

If you attempt delete a property and the update fails, it doesn't restore the property in the display.

If you do a federated search on clusters that don't support 'contains' you get back errors. Should increment to increment the API version and test for it, and decide if client is able to use 'contains' or needs to fall back on '=' or whatever it used before.

#16 Updated by Lucas Di Pentima 6 days ago

  • Target version changed from 2020-02-12 Sprint to 2020-02-26 Sprint

#17 Updated by Lucas Di Pentima 6 days ago

Update at commit:8141f4c40 - branch 15781-multi-value-property-search (arvados repo)

  • Bumps the API revision number to indicate the new contains filter operator to clients.

#18 Updated by Lucas Di Pentima 4 days ago

Update at commit ecd7fabb - branch 15781-multi-value-property-edit (wb2 repo)
Test run: https://ci.arvados.org/view/Developer/job/developer-tests-workbench2/12/

  • Adds API revision number (from discovery document) to sessions, defaulting to zero.
  • Uses 'contains' or 'ilike' when searching properties depending on API revision number.
  • Fixes error handling on properties add/remove operations.
  • Fixes property removal on advanced search editor.
  • Fixes property Chip UI duplication on advanced search editor.

Also available in: Atom PDF