Annotation search: make annotation expansions collapsible

When a link that could be expanded is clicked for the first time, it is
expanded. This commit adds functionality to collapse the sub-tree again
when the link is clicked a second time. For doing this, the data structure
for storing query results had to be changed. It is now a list of lists
where index 0 is used for the main query and one index is used for each
expansion. A stored sub-query result is removed again when its tree gets
collapsed.