Does facet searching come built in when you setup your schema or do you have to do some things to set this up?
Does it basically work out of the box on all the fields th
SolrNet package from Nuget Packages in C# provides a simple way of achieving this. The documentation helps. Here's an example,
public async Task SolrFaceting()
{
Console.WriteLine("facets");
var facetQuery = await _solr.QueryAsync(SolrQuery.All, new QueryOptions
{
Rows = 0,
Facet = new FacetParameters
{
Queries = new[]
{
new SolrFacetFieldQuery("FieldName1"),
new SolrFacetFieldQuery("FieldName2"),
new SolrFacetFieldQuery("FieldName3"),
new SolrFacetFieldQuery("FieldName4"),
},
Limit = 10
}
});
foreach (var facet in facetQuery.FacetFields["FieldName1"]) {
Console.WriteLine("{0}: {1}", facet.Key, facet.Value);
}
foreach (var facet in facetQuery.FacetFields["FieldName2"]) {
Console.WriteLine("{0}: {1}", facet.Key, facet.Value);
}
foreach (var facet in facetQuery.FacetFields["FieldName3"]) {
Console.WriteLine("{0}: {1}", facet.Key, facet.Value);
}
foreach (var facet in facetQuery.FacetFields["FieldName4"]) {
Console.WriteLine("{0}: {1}", facet.Key, facet.Value);
}
}