jina.drivers.rank

class jina.drivers.rank.BaseRankDriver(executor=None, method='score', *args, **kwargs)[source]

Bases: jina.drivers.FlatRecursiveMixin, jina.drivers.BaseExecutableDriver

Drivers inherited from this Driver will bind rank() by default

runtime: Optional[ZEDRuntime]
class jina.drivers.rank.Matches2DocRankDriver(reverse=True, traversal_paths=('r'), *args, **kwargs)[source]

Bases: jina.drivers.rank.BaseRankDriver

This driver is intended to only resort the given matches on the 0 level granularity for a document. It gets the scores from a Ranking Executor, which does only change the scores of matches. Afterwards, the Matches2DocRankDriver resorts all matches for a document. Input-Output

Input:
document: {granularity: 0, adjacency: k}
    |- matches: {granularity: 0, adjacency: k+1}
Output:
document: {granularity: 0, adjacency: k}
    |- matches: {granularity: 0, adjacency: k+1} (Sorted according to scores from Ranker Executor)
runtime: Optional[ZEDRuntime]