Record counts are returned in two dgraph properties.
To retrieve the counts for regular (non-aggregated) or aggregated records beneath a given refinement (dimension value), use these dgraph properties:
For a given
DimensionSearchResult
object, request all dimension
search results with:
The dimension search results for a given dimension are returned in a
DimensionSearchResultGroup
object.
For each dimension value in the group, you can return a
DimLocation
object from a
DimLocationList
. You can then return the
DimVal
object with:
To get a list of properties (PropertyMap object) associated with the dimension value, use:
Calling the
PropertyMap.get()
method (Java) or
PropertyMap
object (.NET) at this point, with the
DGraph.Bins
or
DGraph.AggrBins
argument will return a list of values
associated with that property. This list should contain a single element, which
is the count of non-aggregated or aggregated records beneath the given
dimension value.
Example 70. Java examples
This example gets the refinement counts for all the dimension values. Assume that the refinement counts are enabled globally for all dimension values.
if (results.containsDimensionSearch()) { DimensionSearchResult result = results.getDimensionSearch(); DimensionSearchResultGroupList groups = result.getResults(); for (DimensionSearchResultGroup g : (List<DimensionSearchResultGroup>)groups) { for (DimLocationList l : (List<DimLocationList>)g) { DimLocation loc = (DimLocation)l.get(0); DimVal dimVal = loc.getDimValue(); PropertyMap pmap = dimVal.getProperties(); String dstats = ""; if (pmap.get("DGraph.Bins") != null) { dstats = "(" + pmap.get("DGraph.Bins") + ")"; } } } }
This example gets the refinement counts for all the dimension values in a dimension that has an id of 800000.
if (results.containsDimensionSearch()) { DimensionSearchResult result = results.getDimensionSearch(); DimensionSearchResultGroup group = result.getDimensionSearchResultGroup(800000); for (DimLocationList l : (List<DimLocationList>)group) { DimLocation loc = (DimLocation)l.get(0); DimVal dimVal = loc.getDimValue(); PropertyMap pmap = dimVal.getProperties(); String dstats = ""; if (pmap.get("DGraph.Bins") != null) { dstats = "(" + pmap.get("DGraph.Bins") + ")"; } } }
Example 71. .NET examples
This example gets the refinement counts for all the dimension values. Assume that the refinement counts are enabled globally for all dimension values.
if (results.ContainsDimensionSearch()) { DimensionSearchResult result = results.DimensionSearch; DimensionSearchResultGroupList groups = result.Results; for (int gg = 0; gg < groups.Count; ++gg) { DimensionSearchResultGroup group = (DimensionSearchResultGroup)groups[gg]; for (int ii = 0; ii < group.Count; ++ii) { DimLocationList l = (DimLocationList)group[ii]; DimLocation loc = (DimLocation)l[0]; DimVal dimVal = loc.DimValue; PropertyMap pmap = dimVal.Properties; String dstats = ""; if (pmap["DGraph.Bins"] != null) { dstats = " ("+pmap["DGraph.Bins"]+")"; } } } }
This example gets the refinement counts for all the dimension values in a dimension that has an id of 800000.
if (results.ContainsDimensionSearch()) { DimensionSearchResult result = results.DimensionSearch; DimensionSearchResultGroup group = result.GetDimensionSearchResultGroup(800000); for (int i = 0; i < group.Count; i++) { DimLocationList l = (DimLocationList)group[ii]; DimLocation loc = (DimLocation)l[0]; DimVal dimVal = loc.DimValue; PropertyMap pmap = dimVal.Properties; String dstats = ""; if (pmap["DGraph.Bins"] != null) { dstats = " ("+pmap["DGraph.Bins"]+")"; } } }