cleaning up facet search a bit, and adding tests