//Search with the given query
Map<String, Facet> facets = siteSearchAPI.getFacets( indexName, query );
for ( String key : facets.keySet() ) {
Facet internalFacet = facets.get( key );
//Verify the type of the facet in order to be able to create a proper wrapper for it
if ( internalFacet instanceof InternalStringTermsFacet ) {
InternalStringTermsFacet facet = (InternalStringTermsFacet) internalFacet;