Rank

Build 1501 on 14/Nov/2017  This topic last edited on: 19/Jun/2014, at 10:04

The ‘virtual’ attribute @nav:rank contains the rank (relevance) of an object in the context of the full-text search being executed. It is a number, with bigger values indicating higher = better relevance.

The rank can be used to sort and filter the results of a full-text search, e.g.:

gn4:story[fn:fullText(nav:text, 'Obama')] order by @nav:rank descending

returns all the stories containing ‘Obama’ with the more relevant first; and:

gn4:story[fn:fullText(nav:text, 'Obama') and @nav:rank > 50]

returns all the stories containing ‘Obama’ with a rank (relevance) greater than fifty.

@nav:rank has meaning – and can be used - only in a full-text search, doing something like:

gn4:story[@nav:rank > 50]   -- WRONG

causes an error.

Caveat

Unlike ordering, the filtering using the rank is not supported by Exalead.

Example:

gn4:story[fn:fullText(nav:text, 'Obama') and @nav:rank > 50]

works only in SQL, but not in Exalead.