dataserver icon indicating copy to clipboard operation
dataserver copied to clipboard

include annotation tags for /collections/:key/tags

Open abaevbog opened this issue 1 year ago • 2 comments

Tags for annotations are counted just like items in numItems field. So, if tag A belongs to an annotation of an attachment, and the attachment itself has tag A, numItems will be 2.

Fixes: #162

abaevbog avatar Aug 21 '23 14:08 abaevbog

I see. Now the annotation tags are returned but if we, say, hit /collections/*/items/top?tag=ANNOTATION_TAG, we get an empty response, though we would want to receive the top level item whose attachment's annotation has ANNOTATION_TAG

abaevbog avatar Aug 22 '23 16:08 abaevbog

When in /top mode, we can do an extra join on topLevelItem to fetch the top level itemID, as opposed to the actual item's itemID, when possible. Then, if there is a child annotation with a tag, /collections/*/items/top?tag=ANNOTATION_TAG will return the top level item for that annotation's tag.

It will do the same for other children like notes or attachments - do we want it? The web library calls /collections/*/items/top?tag=... when a tag is selected, and currently it only returns items in the collection whose tags match the query (so tags of, say, attachments do nothing). The desktop tag filtering does allow us to see the top level item when we click on the attachment's or annotation's tag in the left panel, so maybe it's not a bad thing to add it to web library too?

If we want to keep filtering by all children's tags in /top mode, should we return other children's tags when /collections/*/items/top/tags endpoint is hit too? On the desktop app, I can see my attachments tags in the left panel but they are not returned currently with /collections/*/items/top/tags (which web library calls) , so they do not show up.

abaevbog avatar Aug 22 '23 18:08 abaevbog