The first step in displaying refinements is to retrieve those attributes that potentially have refinements.
As an alternative to using RefinementConfig, to retrieve refinements that are not explicitly included in any user-configured attribute groups, you can request a group system-navigation_InternalGroup. This group exists in Endeca Server and includes all refinements that are not members of any other groups.
In the request, either you are using RefinementGroupConfig, or RefinementConfig, you include them in a NavigationMenuConfig. For its format, see NavigationMenuConfig.
Refinements are returned in a NavigationMenu content element. If your attributes belong to groups, this element contains a NavigationMenuItemGroup element with NavigationMenuItem elements for each managed attribute with refinements.
<Request xmlns="http://www.endeca.com/MDEX/conversation/3/0"> <State/> <NavigationMenuConfig Id="NavigationMenu" IncludeAllExplicitSelections="false" IncludeAllImplicitSelections="false"> <RefinementGroupConfig Name="WineCharacteristics" Expose="true"> <RefinementConfig Name="WineType" Expose="true"/> </RefinementGroupConfig> </NavigationMenuConfig> </Request>
Notice that IncludeAllExplicitSelections and IncludeAllImplicitSelections are set to false. This is the default — the request asks to retrieve only those refinements that are still available for navigation (known as suggested refinements), and does not return refinements that have already been applied (which include explicitly-selected and implicit). For information on how to retrieve a full list of refinements, see Retrieving the full list of refinements (applied and suggested).
<cs:Results xmlns:cs="http://www.endeca.com/MDEX/conversation/3/0" xmlns:mdex="http://www.endeca.com/MDEX/XQuery/2009/09"> <State xmlns="http://www.endeca.com/MDEX/conversation/3/0"> <cs:NavigationMenu" Id="NavigationMenu"> <cs:NavigationMenuItemGroup Name="WineCharacteristics" HasRefinablePRoperties="true"> <cs:NavigationMenuItem Name="WineType" DisplayName="Wine Type" MultiSelect="None" HasMore="false"> <cs:ExposureControl Exposed="true"/> <cs:Refinement Name="WineType" Spec="Red" Label="Red" Count="31021"/> <cs:Refinement Name="WineType" Spec="White" Label="White" Count="23031"/> <cs:Refinement Name="WineType" Spec="Sparkling" Label="Sparkling" Count="3020"/> <cs:RootDimensionValue DimensionName="WineType" Spec="/"/> <cs:FullPath> <cs:DimensionValue DimensionName="WineType" Spec="/">WineType</cs:DimensionValue> </cs:FullPath> </cs:NavigationMenuItem> </cs:NavigationMenuItemGroup> </cs:NavigationMenu> </cs:Results>
<cs:NavigationMenuItem Name="WineType" DisplayName="Wine Type" MultiSelect="None" HasMore="false"> <cs:ExposureControl Exposed="true"/>
<cs:ExposureControl Exposed="true"/>The <cs:ExposureControl Exposed=""true"> statement indicates the current exposure status of a top-level refinement included in NavigationMenuItem.
<cs:Refinement Name="WineType" Spec="Red" Label="Red" Count="31021"/>
The Count element indicates that 31,021 records would be in the result set if you were to refine on the Red refinement.
<Request xmlns="http://www.endeca.com/MDEX/conversation/3/0"> <State/> <NavigationMenuConfig Id="NavigationMenu" IncludeAllExplicitSelections="false" IncludeAllImplicitSelections="false"> <RefinementConfig Name="Region" Expose="true" IncludeExplicitSelections="false" IncludeImplicitSelections="false"/> </NavigationMenuConfig> </Request>
This request will return individual suggested refinements from a record set, listing all records for which values exist in the Region attribute. In addition to suggested refinements, you can also optionally return applied refinements for this attribute. For information, see Retrieving applied refinements per attribute.