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 craft() by default

Initialize a BaseExecutableDriver

Parameters
  • executor (Optional[str]) – the name of the sub-executor, only necessary when jina.executors.compound.CompoundExecutor is used

  • method (str) – the function name of the executor that the driver feeds to

  • *args

    *args for super

  • **kwargs

    **kwargs for super

runtime: Optional[ZEDRuntime]
class jina.drivers.search.KVSearchDriver(is_update=True, traversal_paths='m', *args, **kwargs)[source]

Bases: jina.drivers.RecursiveMixin, 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

Construct the driver.

Parameters
  • is_update (bool) – when set to true the retrieved docs are merged into current message; otherwise, the retrieved Document overrides the existing Document

  • traversal_paths (Tuple[str]) – traversal paths for the driver

  • *args

    *args for super

  • **kwargs

    **kwargs for super

runtime: Optional[ZEDRuntime]
class jina.drivers.search.VectorFillDriver(executor=None, method='query_by_key', *args, **kwargs)[source]

Bases: jina.drivers.RecursiveMixin, 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.FastRecursiveMixin, jina.drivers.QuerySetReader, jina.drivers.search.BaseSearchDriver

Extract embeddings from the request for the executor to query.

Construct the driver.

Parameters
  • top_k (int) – top-k document ids to retrieve

  • fill_embedding (bool) – fill in the embedding of the corresponding doc, this requires the executor to implement query_by_key()

  • *args

    *args for super

  • **kwargs

    **kwargs for super

runtime: Optional[ZEDRuntime]