forked from 0x2620/pandora
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!)
|
||
|---|---|---|
| .. | ||
| annotation | ||
| app | ||
| archive | ||
| changelog | ||
| clip | ||
| document | ||
| edit | ||
| entity | ||
| event | ||
| item | ||
| itemlist | ||
| log | ||
| news | ||
| oxdjango | ||
| person | ||
| place | ||
| sequence | ||
| templates | ||
| text | ||
| title | ||
| tv | ||
| urlalias | ||
| user | ||
| websocket | ||
| __init__.py | ||
| config.0xdb.jsonc | ||
| config.indiancinema.jsonc | ||
| config.padma.jsonc | ||
| config.pandora.jsonc | ||
| gunicorn_config.py.in | ||
| manage.py | ||
| settings.py | ||
| urls.py | ||
| wsgi.py | ||