jina.drivers.search¶
-
class
jina.drivers.search.
BaseSearchDriver
(executor=None, method='query', traversal_paths=('r', 'c'), *args, **kwargs)[source]¶ Bases:
jina.drivers.BaseExecutableDriver
Drivers inherited from this Driver will bind
query()
by defaultInitialize a
BaseExecutableDriver
- Parameters
executor (
Optional
[str
]) – the name of the sub-executor, only necessary whenjina.executors.compound.CompoundExecutor
is usedmethod (
str
) – the function name of the executor that the driver feeds toargs – additional positional arguments which are just used for the parent initialization
kwargs – additional key value arguments which are just used for the parent initialization
-
runtime
: Optional[ZEDRuntime]¶
-
class
jina.drivers.search.
KVSearchDriver
(is_update=True, traversal_paths=('m'), *args, **kwargs)[source]¶ Bases:
jina.drivers.ContextAwareRecursiveMixin
,jina.drivers.search.BaseSearchDriver
Fill in the results using the
jina.executors.indexers.meta.BinaryPbIndexer
Warning
This driver runs a query for each document. This may not be very efficient, as the total number of queries grows cubic with the number of documents, chunks per document and top-k.
traversal_paths = [‘m’] => D x K
traversal_paths = [‘r’] => D
traversal_paths = [‘cm’] => D x C x K
traversal_paths = [‘m’, ‘cm’] => D x K + D x C x K
- where:
D is the number of queries
C is the number of chunks per document
K is the top-k
- param is_update
when set to true the retrieved docs are merged into current message; otherwise, the retrieved Document overrides the existing Document
- param traversal_paths
traversal paths for the driver
- param args
additional positional arguments which are just used for the parent initialization
- param kwargs
additional key value arguments which are just used for the parent initialization
-
runtime
: Optional[ZEDRuntime]¶
-
class
jina.drivers.search.
VectorFillDriver
(executor=None, method='query_by_key', *args, **kwargs)[source]¶ Bases:
jina.drivers.FlatRecursiveMixin
,jina.drivers.QuerySetReader
,jina.drivers.search.BaseSearchDriver
Fill in the embedding by their document id.
-
runtime
: Optional[ZEDRuntime]¶
-
-
class
jina.drivers.search.
VectorSearchDriver
(top_k=50, fill_embedding=False, *args, **kwargs)[source]¶ Bases:
jina.drivers.FlatRecursiveMixin
,jina.drivers.QuerySetReader
,jina.drivers.search.BaseSearchDriver
Extract embeddings from the request for the executor to query.
- Parameters
top_k (
int
) – top-k document ids to retrievefill_embedding (
bool
) – fill in the embedding of the corresponding doc, this requires the executor to implementquery_by_key()
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
-
runtime
: Optional[ZEDRuntime]¶