pandora/pandora/annotation
Will Thompson aa40a40595
Annotation.json: only include entity id & name
Fetching documents for each entity in turn is expensive. (I have tried
using ArrayAgg to fetch them in the same query as the Entity — no
improvement. It's possible that being able to join to entity_entity,
and then use ArrayAgg, would be better.)

Even once you've fetched them all, if the same entity appears many
times in an item, then get(..., keys=['layers']) duplicates the whole
JSON for the entity many times: expensive to serialize, expensive to
send over the wire.

Pandora's own web interface only depends on the 'id' key of 'entity' in
each annotation, and refetches the rest of the entity to show the pop-up
dialog when you press E. So by just not bothering to fetch and send any
other keys, get(..., keys=['layers']) on an item with many entity
annotations is substantially faster.

(I experimented with splitting the full entities off to one side, so,
you'd have:

    {
        "layers": {
            somelayer: [...,
              {..., "entity": {"id": ABC}},
            ], ...
        },
        "entities": {
            ABC: {...},
            ...
        }
    }

This is quicker than the status quo, but obviously not as fast as not
fetching & sending the rest at all!)
2016-04-28 14:15:23 +01:00
..
management use transaction.atomic 2016-02-19 21:55:09 +05:30
migrations db migration 2016-02-20 15:15:01 +05:30
__init__.py display code in api browser 2011-01-26 18:55:26 +05:30
admin.py remove layer of indirection 2011-11-02 15:06:34 +01:00
managers.py findAnnotations: match some fields case-sensitively 2016-04-05 12:19:32 +01:00
models.py Annotation.json: only include entity id & name 2016-04-28 14:15:23 +01:00
tasks.py fix annotation import, values are decoded in d1.9 2016-03-05 15:36:47 +05:30
utils.py allow language attributes in text and annotations 2013-12-26 16:41:40 +00:00
views.py Rename api.taskStatus to api.getTaskStatus 2016-02-20 18:35:26 +05:30