You can use API calls to set the dynamic refinement configuration for the navigation query.
An alternative to the Nrc
parameter is to use API calls to create and set the dynamic refinement configuration for the navigation query. The general procedure is:
You first create a refinement configuration for each dimension value by using the calls of the
RefinementConfig
class. Each refinement configuration will be aRefinementConfig
object.You then encapsulate the
RefinementConfig
objects in aRefinementConfigList
object.Finally, you set the refinement configuration list for the query by using the
ENEQuery.setNavRefinementConfigs()
method (Java) or theENEQuery.NavRefinementConfigs
property (.NET).
The constructor of the RefinementConfig
class takes the ID of a dimension value to create a RefinementConfig
object for that dimension value and its children (if any). You then use various setter calls to set the specific configuration attributes. Note that these calls correspond to settings of the Nrc
parameter.
Dynamic ranking for the dimension value is set by these RefinementConfig
calls (which correspond to the Nrc
dynrank
setting):
Specifically enabled with the Java
setDynamicRankingEnabled()
method or the .NETDynamicRanking
property with an argument ofENABLED
.Specifically disabled with the Java
setDynamicRankingDisabled()
method or the .NETDynamicRanking
property with an argument ofDISABLED
.Set to use the Developer Studio setting with the Java
setDynamicRankingDefault()
method or the .NETDynamicRanking
property with an argument ofDEFAULT
.
The RefinementConfig.setExposed()
method (Java) or RefinementConfig.Exposed
property (.NET) specify whether to expose the dimension value's refinements. These calls correspond to the Nrc
exposed
setting.
The sort method for the returned dimension value is set by these RefinementConfig
calls (which correspond to the Nrc
dynorder
setting):
Set a dynamic sort order with the Java
setDynamicRankOrderDynamic()
method or the .NETDynamicRankOrder
property with an argument ofDYNAMIC
.Set a static sort order with the Java
setDynamicRankOrderStatic()
method or the .NETDynamicRankOrder
property with an argument ofSTATIC
.Use the Developer Studio settings with the Java
setDynamicRankOrderDefault()
method or the .NETDynamicRankOrder
property with an argument ofDEFAULT
)
The maximum number of dimension values to return is set with the RefinementConfig.setDynamicRefinementCount()
method (Java) or the RefinementConfig.DynamicRefinementCount
property (.NET). Use an empty OptionalInt
argument to use the Developer Studio setting. These calls correspond to the Nrc
dyncount
setting.
The following is a simple Java example of setting a dynamic refinement configuration on the dimension value with an ID of 7:
// create an empty refinement config list RefinementConfigList refList = new RefinementConfigList(); // create a refinement config for dimval 7 RefinementConfig refConf = new RefinementConfig(7); // enable dynamic refinement ranking for this dimval refConf.setDynamicRankingEnabled(); // set a dynamic sort order refConf.setDynamicRankOrderDynamic(); // expose the refinements refConf.setExposed(true); // set maximum number of returned refinements to 5 OptionalInt refCount = new OptionalInt(5); refConfsetDynamicRefinementCount(refCount); // add the refinement config to the list refList.add(0, refConf); // set the refinement config list in the query usq.setNavRefinementConfigs(refList);
The constructor of the RefinementConfigList
class will create an empty list. You then insert RefinementConfig
objects into the list with:
You set the refinement configuration list for the query by using: