For each dimension that has been enabled to return refinement counts, the MDEX Engine returns refinement counts for records that match descriptors. Descriptors are selected dimension values in this navigation state.
The refinement counts that the dgraph
returns for descriptors are returned with the
DGraph.Bins or
DGraph.AggrBins property on the descriptor
DimVal object returned through the Oracle Commerce navigation
API.
The count represents the number of records (or aggregate records, in the
case of
DGraph.AggrBins) that match this dimension value in
the current navigation state.
This capability of retrieving refinement counts for descriptors is the default behavior of the MDEX Engine. No additional configuration (for example, dgraph command line options) is needed to enable this capability.
To access the refinement counts for descriptors:
Retrieve the list of dimensions with descriptors. To do this use the
Navigation.getDescriptorDimensions()method (Java), or theNavigation.DescriptorDimensionsproperty (.NET).For each dimension, retrieve the dimension value that has been selected from this dimension (the descriptor). To do this, use the
Dimension.getDescriptor()method (Java) orDimension.Descriptorproperty (.NET).Retrieve the
PropertyMapobject which represents the properties of the dimension value. To do this, use theDimVal.getProperties()method (Java) or theDimVal.Propertiesproperty (.NET) on that dimension value.Obtain a list of values associated with that property. Use the
PropertyMap.get()method (Java) orPropertyMapobject (.NET) with theDGraph.BinsorDGraph.AggrBinsargument.This list should contain a single element which is the number of records (or aggregate records) that match this dimension value in the current navigation state.
Example 47. Java example of getting refinement counts for a descriptor
Navigation nav = ENEQueryResults.getNavigation();
// Get the list of dimensions with descriptors
DimensionList dl = nav.getDescriptorDimensions();
// Loop through the list
for (int i = 0; i < dl.size(); i++) {
// Get a dimension from the list
Dimension d = (Dimension)dl.get(i);
// Get the descriptor and then its count(s)
DimVal desc = d.getDescriptor();
// Get the map of properties for the descriptor
PropertyMap pmap = desc.getProperties();
// Get the record count
String recordCount = "";
if (pmap.containsKey("DGraph.Bins")) {
recordCount = " (" + pmap.get("DGraph.Bins") + ")";
}
// Get the aggregate record count
String aggregateRecordCount = "";
if (pmap.containsKey("DGraph.AggrBins")) {
aggregateRecordCount = " (" + pmap.get("DGraph.AggrBins") + ")";
}
}Example 48. .NET example of getting refinement counts for a descriptor
Navigation nav = ENEQueryResults.Navigation;
// Get the list of dimensions with descriptors
DimensionList dl = nav.DescriptorDimensions;
// Loop through the list
for(int i = 0; i < dl.Count; i++) {
// Get a dimension from the list
Dimension d = (Dimension)dl[i];
// Get the descriptor and then its count(s)
DimVal desc = d.Descriptor;
// Get the map of properties for the descriptor
PropertyMap pmap = desc.Properties;
// Get the record count
String recordCount = "";
if (pmap["DGraph.Bins"] != null) {
recordCount = " (" + pmap["DGraph.Bins"] + ")";
}
// Get the aggregate record count
String aggregateRecordCount = "";
if (pmap["DGraph.AggrBins"] != null) {
aggregateRecordCount = " (" + pmap["DGraph.Bins"] + ")";
}
}
