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 the Oracle Endeca Server and includes all refinements that are not members of any other groups.
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/2/0"> <State/> <ContentElementConfig xsi:type="NavigationMenuConfig" Id="NavigationMenu" HandlerFunction="NavigationMenuHandler" HandlerNamespace="http://www.endeca.com/MDEX/conversation/2/0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <RefinementGroupConfig Name="Wine Characteristics" Expose="true"> <RefinementConfig Name="WineType" Expose="true"/> </RefinementGroupConfig> </ContentElementConfig> </Request>
<cs:Results xmlns:cs="http://www.endeca.com/MDEX/conversation/2/0" xmlns:mdex="http://www.endeca.com/MDEX/XQuery/2009/09"> <cs:Request> <State xmlns="http://www.endeca.com/MDEX/conversation/2/0"> <ContentElementConfig xsi:type="NavigationMenuConfig" Id="NavigationMenu" HandlerFunction="NavigationMenuHandler" HandlerNamespace="http://www.endeca.com/MDEX/conversation/2/0" xmlns="http://www.endeca.com/MDEX/conversation/2/0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <RefinementGroupConfig Name="Wine Characteristics" Expose="true"> <RefinementConfig Name="WineType" Expose="true" xmlns:ns="http://www.endeca.com/MDEX/conversation/2/0"> </RefinementGroupConfig> </ContentElementConfig> </cs:Request> <cs:ContentElement xsi:type="cs:NavigationMenu" Id="NavigationMenu" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <cs:NavigationMenuItemGroup Name="Wine Characteristics" HasRefinablePRoperties="true"> <cs:NavigationMenuItem Name="WineType" DisplayName="WineType" MultiSelect="Or" HasMore="false"> <cs:ExposureControl Exposed="true"> <cs:Operator OwnerId="NavigationMenu" xsi:type="cs:RefinementHideOperator" Name="WineType" Spec="/" Group="Wine Characteristics"/> </cs:ExposureControl> <cs:Refinement Name="WineType" Spec="/Red" Label="Red" Count="18"> <cs:Operator xsi:type="cs:RefinementOperator" Name="WineType" Spec="/Red"/> </cs:Refinement> <cs:Refinement Name="WineType" Spec="/White" Label="White" Count="40"> <cs:Operator xsi:type="cs:RefinementOperator" Name="WineType" Spec="/White"/> </cs:Refinement> <cs:Refinement Name="WineType" Spec="/Sparkling" Label="Sparkling" Count="50"> <cs:Operator xsi:type="cs:RefinementOperator" Name="WineType" Spec="/Sparkling"/> </cs:Refinement> <cs:RootDimensionValue DimensionName="WineType" Spec="/"/> </cs:NavigationMenuItem> </cs:NavigationMenuItemGroup> </cs:ContentElement> </cs:Results>
<cs:NavigationMenuItemGroup Name="Wine Characteristics" HasRefinablePRoperties="true"> <cs:NavigationMenuItem Name="WineType" DisplayName="WineType" MultiSelect="Or" HasMore="false"> <cs:ExposureControl Exposed="true"> <cs:Operator OwnerId="NavigationMenu" xsi:type="cs:RefinementHideOperator" Name="WineType" Spec="/" Group="Wine Characteristics"/> </cs:ExposureControl>
<cs:Operator xsi:type="cs:RefinementOperator" Name="WineType" Spec="/Red"/>This operator will be used in the subsequent Conversation Web Service request to retrieve refinements.
<cs:ExposureControl Exposed="true"> <cs:Operator OwnerId="NavigationMenu" xsi:type="cs:RefinementHideOperator" Name="WineType" Spec="/" Group="Wine Characteristics"/> </cs:ExposureControl>The <cs:ExposureControl Exposed=""true"> statement indicates the current exposure status of a top-level refinement included in NavigationMenuItem. The ExposureControl operator can include two complex types — RefinementExposeOperator and RefinementHideOperator. These operators are used for exposing (or hiding) individual refinements. To use these operators, you must specify the OwnerId value, which should be the same as the content element to which the operators are applied. In the example: OwnerId="NavigationMenu".
<cs:Refinement Name="WineType" Spec="/Red" Label="Red" Count="18"> <cs:Operator xsi:type="cs:RefinementOperator" Name="WineType" Spec="/Red"/> </cs:Refinement>
The Count element indicates that eighteen records would be in the result set if you were to refine on the Red refinement.
<Request xmlns="http://www.endeca.com/MDEX/conversation/2/0"> <State/> <ContentElementConfig xsi:type="NavigationMenuConfig" Id="NavigationMenu" HandlerFunction="NavigationMenuHandler" HandlerNamespace="http://www.endeca.com/MDEX/conversation/2/0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <RefinementConfig Name="Region" Expose="true"/> </ContentElementConfig> </Request>
This request will return individual refinements from a record set, listing all records for which values exist in the Region attribute.