The dgraph
--stat-brel
flag creates a dynamic property on each
record named
DGraph.BinRelevanceRank
. The value of this property
reflects the relevance rank assigned to a record in full text search.
The Java
ERec.getProperties()
method and the .NET
ERec.Properties
property return a list of properties
(PropertyMap
object) associated with the record. At this
point, calling the Java
PropertyMap.get()
method or the .NET
PropertyMap
object with the
DGraph.BinRelevanceRank
argument returns the value of
the property.
The following code samples show how to retrieve the
DGraph.BinRelevanceRank
for a given record.
Example 90. Java example
// get the record list from the navigation object ERecList recs = nav.getERecs(); // loop over record list for (int i=0; i<recs.size(); i++) { // get individual record ERec rec = (ERec)recs.get(i); // get property map for record PropertyMap propsMap = rec.getProperties(); // Check for a non-null relevance rank property if (propsMap.get("DGraph.BinRelevanceRank") != null) { String rankNum = (String)propsMap.get("DGraph.BinRelevanceRank"); %>Relevance ranking for this record: <%= rankNum %> <% } // end of if } // end of for loop iteration
Example 91. .NET example
// get the record list from the navigation object ERecList recs = nav.ERecs; // loop over record list for (int i=0; i<recs.Count; i++) { // get individual record ERec rec = (ERec)recs[i]; // get property map for record PropertyMap propsMap = rec.Properties; // Check for a non-null relevance rank property String rankNum = ""; if (propsMap["DGraph.BinRelevanceRank"] != null) { rankNum = (String)propsMap["DGraph.BinRelevanceRank"]; %>Relevance ranking for this record: <%= rankNum %> <% } // end of if } // end of for loop iteration
The MDEX Engine sorts records for relevance ranking using a more
granular algorithm than the number you retrieve with
DGraph.BinRelevanceRank
.
If, for example, you need to interpret the values of the
DGraph.BinRelevanceRank
property for two different
records, it is helpful to know that while these values roughly represent the
sorting used for relevance-ranked records, they are not as precise as the
internal sorting numbers the MDEX Engine actually uses to sort the records.
For example, you may see the same
DGraph.BinRelevanceRank
value for two records that are
sorted slightly differently. When interpreting the results of
DGraph.BinRelevanceRank
for two different records,
consider these values as providing rough guidance only on whether one record
has a significantly higher relevance rank than the other. However, if the value
of
DGraph.BinRelevanceRank
is the same, this does not
mean that the records are sorted the same, since the underlying sorting
mechanism in the MDEX Engine is more precise. It is important to note that the
MDEX Engine always returns consistent results and consistently interprets tie
breaks in sorting, if they occur.