Solr - Facet Query

The Solr query for a facets filter click is similar to a query for the overall page. It just adds a filter parameter to the JSON request.

The syntax is filter: "facet:facetfilter", where the facet is the facet ID and facetfilter is the filter string. The facetfilter string will likely have a space, and spaces need to be escaped, e.g. filter: "environment:Epic\ Hyperspace".

The filter JSON parameters can be strung together in an array, so the whole JSON might look like this:

https://webserverredirect.org/solr/select?rows=1000&wt=json&sort=count desc, title asc&json=
{
    query: "*:*",
    fields: "id, count, description, hyperlink, image, title"
    filter: ["data_source:gallery-covid","environment:Epic\ Hyperspace"]
    facet: {
        environment: {
            type: "terms",
            field: "environment"
        },
        producttype: {
            type: "terms",
            field: "producttype"
        }
    }
}