Skip to content

Documents

Daniel Whyte edited this page Jul 21, 2016 · 1 revision

Document Children

The top level documents (archives) have a number of children which are displayed in the 'browse this archive' section at the bottom of the document resource page.

These children are retrieved from elasticsearch at the documents endpoint. They are found by searching for all documents with the parent.admin.uid matching the id of the current document.

Some of these documents themselves have children, which are not included in the initial response, so as to save making a large number of database requests. Instead, they are found using an ajax request when the user clicks on the '+' button. When this occurs, an 'expanded' query, with the id of the document, is added to the url, e.g.

http://localhost:8000/documents/smga-documents-110000003?expanded=smgc-documents-110000036

This query is validated using Joi, to make sure it always conforms to the format {smgc/a}-documents-{number}.

This may change in the future when we are caching the api/database responses, if it is more performant.

Clone this wiki locally