jina.drivers.rank.aggregate¶
-
jina.drivers.rank.aggregate.
COL_STR_TYPE
= 'U64'¶ the ID column data type for score matrix
-
class
jina.drivers.rank.aggregate.
BaseAggregateMatchesRankerDriver
(keep_source_matches_as_chunks=False, *args, **kwargs)[source]¶ Bases:
jina.drivers.rank.BaseRankDriver
Drivers inherited from this Driver focus on aggregating scores from chunks to its parents.
- Parameters
keep_source_matches_as_chunks (
bool
) – A flag to indicate if the driver must return the old matches of the query or its chunks (at a greater granularity level (k + 1)) as the chunks of the new computed matches (at granularity level k) Set it to True when keeping track of the chunks that lead to a retrieved result.args – additional positional arguments which are just used for the parent initialization
kwargs – additional key value arguments which are just used for the parent initialization
Note
When set keep_source_matches_as_chunks=True, the chunks of the match contains ONLY the chunks leading to the match rather than ALL the chunks of the match.
-
class
QueryMatchInfo
(match_parent_id, match_id, query_id, score)¶ Bases:
tuple
Create new instance of QueryMatchInfo(match_parent_id, match_id, query_id, score)
-
match_id
¶ Alias for field number 1
-
match_parent_id
¶ Alias for field number 0
-
query_id
¶ Alias for field number 2
-
score
¶ Alias for field number 3
-
-
runtime
: Optional[ZEDRuntime]¶
-
class
jina.drivers.rank.aggregate.
Chunk2DocRankDriver
(traversal_paths=('r'), *args, **kwargs)[source]¶ Bases:
jina.drivers.rank.aggregate.BaseAggregateMatchesRankerDriver
Extract matches score from chunks and use the executor to compute the rank and assign the resulting matches to the level above.
- Input-Output ::
Input: document: {granularity: k-1}
Output: document: {granularity: k-1}
-
runtime
: Optional[ZEDRuntime]¶
-
class
jina.drivers.rank.aggregate.
AggregateMatches2DocRankDriver
(traversal_paths=('r'), *args, **kwargs)[source]¶ Bases:
jina.drivers.rank.aggregate.BaseAggregateMatchesRankerDriver
This Driver is intended to take a document with matches at a given granularity > 0, clear those matches and substitute these matches by the documents at a lower granularity level. Input-Output
Input: document: {granularity: k} |- matches: {granularity: k} Output: document: {granularity: k} |- matches: {granularity: k-1} (Sorted according to Ranker Executor)
Imagine a case where we are querying a system with text documents chunked by sentences. When we query the system, we use sentences (chunks) to query it. So at some point we will have: `query sentence (documents of granularity 1):
matches: indexed sentences (documents of level depth 1)`
` But in the output we want to have the full document that better matches the sentence. `query sentence (documents of granularity 1):
matches: indexed full documents (documents of granularity 0).
` Using this Driver before querying a Binary Index with full binary document data can be very useful to implement a search system.
-
runtime
: Optional[ZEDRuntime]¶
-