Added term facets to search query. #6543

Added a test for facets.