Refactor bits of advanced search

This commit never made it to develop/release branch because it was merged into a feature branch that was already merged at the time. https://github.com/reciprocity/ggrc-core/pull/1633