Solr and facet search

Yes, you can facet any indexed field out of the box. However it might not give you the results you expect until you configure faceting fields according to your data types.

Faceting is enabled and used through the facet.* parameters, not fq. fq is used when the user selects a facet value.

Some good Solr tutorials:


Yes, Simply add &facet=true&facet.field={fieldname} to your request Url.

Here is another tutorial:Faceting

The below code in C#, by using SolrNet package. The Facet you can do it on the fields stored in SOLR, make sure its string and doesn't have space for better results. The mincount is for limiting the minimum number to get listed in facet.

        QueryOptions options = new QueryOptions
            Facet = new FacetParameters
                Queries = new ISolrFacetQuery[]
                    new SolrFacetFieldQuery("field1"),
                    new SolrFacetFieldQuery("field2")
                MinCount = 20

And the below code to get the results, query - is the search entered in front end.

    var result = solr.Query(query, options);