tator
tator copied to clipboard
String array attribute type
Add a new attribute type string_array
that will allow for things like "tags" and use a front end widget that populates an area with pills. Autocomplete should be supported. In PSQL they will simply be part of the JSON attributes, in elasticsearch the items will be indexed as keywords. Migration to different data types will not be supported initially.
One thing to think about here is whether it is better to PATCH an object with the full array or to have some kind of append/remove methods, tentatively leaning toward the former.
In an ES-less world another implementation path is something like the following:
-Add a new JSONB field (one could piggy back off attributes, but that might be messy).
- In the DB for a record, a tag of 'Really Cool' would be applied in the that field as so:
{'tags': {'Really Cool': true}}
- You could then search on those tags via the ORM by looking for
Object.filter(tags__really_cool__isnull=False) # or tags__really_cool = True
- If they were needed one could also index them with a BTREE index
Searching on tags, I could see anyOf
and allOf
being operations added to AttributeOperationSpec
in object_search
The comments above relate to 'filtering tags' which are akin to tags in github. E.g. being able to search on bugs vs. feature requests.
Also of note, its possible doing a list of strings with a TGRM-based index is also effecvtive here. Would require some prototype whether key/val in an object on btree is better.
Of note, in the example above the lack of a tag in the tags object means the tag is not applied, so a literal false is not required for all possible tags.