Composite Refinement Web Part
The Composite Refinement Web Part (CRWP) offers the same functionality as the Refinement Web Part and additionally provides a high flexibility in how the refinement groups are rendered. It was introduced as part of MatchPoint 4.0.5.
The Composite Refinement Web Part is a flexible implementation of the Refinement Web Part. However, the Refinement Web Part will not be marked deprecated. Both Web Parts will be developed next to each other.
In a CRWP configuration you can define groups, which are the equivalent
to Columns
in the RWP configuration. For each group you can configure
some settings, e.g. which field to refine, if it's collapsible, the
FieldType and so on. Each group has a renderer. All renderers provide a
default template and settings and can therefore be used out of the box.
You can however provide your own template / settings for most of these
renderers and customize them according to your requirements.
Refinement Groups
Range Refinement Group
This group can be used for the refinement of date and number ranges.
Boundaries
Optionally you can define the bucket boundaries in which your values will be grouped (e.g. 0, 10, 20, etc.). If you don't define any boundaries, they will be automatically generated for you.
RangeRenderer
Displays a slider with the defined boundaries. You can choose if you want to display a histogram or not.
Simple Refinement Group
The SimpleRefinementGroup can be used for almost all field types. Normally this group will simply display all found values as selectable items. But you can also use this group to display ranges (for example if you don't like the slider from the RangeRefinementGroup), for this reason you can define buckets (similar to the RangeRefinement).
Buckets
Optionally you can define your bucket boundaries in which the values will be grouped. The buckets can be used for date and number types only.
FlatSimpleRenderer
In this renderer you can define
a RowTemplate
and
a SelectedRowTemplate.
This means you can style your SimpleRefinementGroup
exactly the way you
want to. You just have to set the data-clickScript
and the data-Key
attribute on the element which should be clickable, respectively used to
execute the refinement, by the user. Also you can define how many
elements you want to display directly
(NumberOfElements)
and how many elements you want to display in the ShowMore-Callout
(ShowMoreNumberOfElements).
Available Expression Variables
The following ExpressionVariables are available within the renderer:
Node
: The CompositeRefinementNode which contains all information about the current refinement node, e.g.Value
,Key
,IsRoot
,IsSelected
and so on. For more details see the CompositeRefinementNode class.Label
: The label of the composite refinement nodeCount
: The number of occurrences of the DataItem in the result set. Also available withNode.Occurrences
.Key
: The key which identifies the DataItem. Also available withNode.Key
.DataItem
: The item which is also used as the refinement value. Also available withNode.Value
.
Tag Refinement Group
Can be used to display tags which are applied to the items you want to refine.
FlatTagRenderer
Flat means that all tags will be displayed the same way - no matter if they are "parent" or "child" tags. The other settings are very similar to the FlatSimpleRenderer.
HierarchicalTagRenderer
Since tags can have children and therefore can be hierarchical, it may be desired that they are also
displayed in a hierarchical order. For this purpose
the HierarchicalTagRenderer
can be used. In addition to the FlatTagRenderer you can define
a RootHierarchyLevelHeader
/ Footer and
a HierarchyLevelHeader
/ Footer.
You can also define a OnRenderCompleteScript
which defines a
JavaScript method that is executed after the complete hierarchy has
been rendered and after each consecutive refresh (e.g. when the
refiners are updated). For details please refer to the example
below, where we extended the HierarchicalTagRenderer with a
OnRenderCompleteScript
function and additional HTML.
Available ExpressionVariables
The following ExpressionVariables are available within the renderer:
Node
: The CompositeRefinementNode which contains all information about the current refinement node, e.g. Value, Key, IsRoot, IsSelected and so on. For more details see theCompositeRefinementNode
class.Count
: The number of occurrences of the Tag in the result set. Also available withNode.Occurrences
.Tag
: The tag which is also used as the refinement value. Also available withNode.Value
.
Term Refinement Group
This group is only available with the MatchPoint Server component. It can be used to display terms which are applied to the items you want to refine. It follows the same logic the Tag Refinement Group does.
Available ExpressionVariables
The following ExpressionVariables are available within the renderer:
Node
: TheCompositeRefinementNode
which contains all information about the current refinement node, e.g.Value
,Key
,IsRoot
,IsSelected
and so on. For more details see theCompositeRefinementNode
class.Count
: The number of occurrences of the Term in the result set. Also available withNode.Occurrences
.Key
: The key which identifies the Term. Also available withNode.Key
.Term
: The Term which is also used as the refinement value. Note: The currentNode.Value
is either a Term or a TermSet (the other variable is null). Also available withNode.Value
.TermSet
: The TermSet which is also used as the refinement value (only for Caml-Queries). Note: The currentNode.Value
is either a Term or a TermSet (the other variable is null). Also available withNode.Value
.Label
: The label in the "CurrentUICulture" of the term.
API
Custom Renderers
You can implement your own Renderer by implementing IRenderer (or any of the existing public renderers).
Each Group has its own Renderer interface (e.g. the SimpleRefinementGroup has a ISimpleRenderer Member). You can control the visibility of your Renderer within the groups using these interfaces.
Custom Groups
You can implement your own Group by extending BaseRefinementGroup. Your group should have a Renderer member, with an own interface implementing the IRenderer interface. This renderer should be returned in the GetRenderer method.