Solr Facets (Taxonomy Facet Bucket)

Vote:
 

I need help creating a taxonomy facet bucket for Solr.

The client has hundreds of Taxonomny categories.  They would like three of them to appear in a facet.  I am working on switching a them from Google search to Solr.  One aspect of their current search is that they list the search results into a single page with three tabs: News, Events & Articles.  (Each of which is a distinct taxonomy.)

Great!  I'm thinking this should be pretty easy, just create a facet bucket with these three taxonomy categories & I'll be done.  Not so fast.  Whereas the DateRefinementSpecification exposes the Thresholds BoundedRefinementSpecification, there is no corresponding refinement for the StringRefinementSpecification (The Taxonomy refinement is a string).

I know the KeywordSearchCriteria will accept a RefinementSpecification argument to the Refinement.Add() method, but how do I build that up?

I've been following Chris Banner's excellent blog post here - but the best I've been able to get declared without issue is the following:  

StringRefinementSpecification taxNameSpec = new StringRefinementSpecification(SearchSolrProperty.CreateExactStringProperty(SearchContentProperty.TaxonomyCategory));

and from there I am lost - can't seem to add anything to the Property property of the StringRefinementSpecification object.  If I had some sample code that allowed me to create a RefinementSpecification object, then I could assign it to the Property property of the StringRefinementSpecification.  

All thoughts & feedback would be greatly appreciated.

Any thoughts?

#184981
Nov 07, 2017 19:11
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.