[WIP] Add aggregates to search queries.

We should probably check for an empty string here (ie an empty builder).