adds query facets, fixes sort fields