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

class jina.drivers.search.KVSearchDriver(is_merge=True, *args, **kwargs)[source]

Bases: jina.drivers.search.BaseSearchDriver

Fill in the doc/chunk-level top-k results using the jina.executors.indexers.meta.BinaryPbIndexer

Warning

This driver loops over all chunk/chunk’s top-K results, each step fires a query. This may not be very efficient, as the total number of queries depends on level

  • level=chunk: D x C x K

  • level=doc: D x K

  • level=all: D x C x K

where:
  • D is the number of queries

  • C is the number of chunks per query/doc

  • K is the top-k

Parameters

is_merge (bool) – when set to true the retrieved docs are merged into current message using MergeFrom(), otherwise, it overrides the current message using CopyFrom()

class jina.drivers.search.VectorFillDriver(executor=None, method='query_by_id', *args, **kwargs)[source]

Bases: jina.drivers.QuerySetReader, jina.drivers.search.BaseSearchDriver

Fill in the embedding by their doc id

class jina.drivers.search.VectorSearchDriver(top_k=50, fill_embedding=False, *args, **kwargs)[source]

Bases: jina.drivers.QuerySetReader, jina.drivers.search.BaseSearchDriver

Extract chunk-level embeddings from the request and use the executor to query it

Parameters
  • top_k (int) – top-k doc id to retrieve

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

  • args

  • kwargs