Skip to content

has_named_entities check makes a lot of queries #1875

@lukavdplas

Description

@lukavdplas

The corpus API includes a property has_named_entities that checks whether named entity annotations are available. The value is taken from a property that checks this with a query.

This query is made every time a user loads the home page, for every corpus they can see (even ones that do not support named entity data). This is a lot of queries, which slows down the page. Also, this property does not need to be checked all the time.

Solution:

  • Move the query to the save_corpus module so it is run when a Python corpus is imported and/or during server startup.
  • Only check this if the corpus definition includes named entity fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendchanges to the django backendcode qualitycode & performance improvements that do not affect user functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions