Skip to content

Metadata summary for study documents

Johannes Zumthurm requested to merge summary into master

Created by: NotSpecial

Currently, we have a lot of metadata for study docs, but no efficient way to search through it. In order to provide users a menu to select professors, for example, an application would have to download all study documents to learn the possible professors.

On the other hand, this information is much needed, as most students will not know from the top of their head how exactly their professors name might be written or if their lecture can be found as 'Analysis' or 'Analysis I'

This defeats the purpose of filtering study documents with metadata.

Thus, this commit adds the possibility to request a server-side summary of metadata by appending summary to the query string, e.g.

/studydocuments?summary

The response then contains a new meta field _summary, which lists the available values for all meta-data fields along with how many documents are available for them.

_summary:
    professor:
        Prof. Dr. Awesome: 10
        Prof. Okay: 5
        ...
    lecture:
        ...
    ...

(For sanity reasons, the author field is not included in the summary, as most authors will only have a single document and thus the summary would be very large)

The summary is efficiently computed using the MongoDB aggregation framework.

Merge request reports

Loading