jina.drivers.querylang.slice

class jina.drivers.querylang.slice.SliceQL(start, end=None, *args, **kwargs)[source]

Bases: jina.drivers.QuerySetReader, jina.drivers.ContextAwareRecursiveMixin, jina.drivers.BaseRecursiveDriver

Restrict the size of the docs to k (given by the request)

Example:: - !ReduceAllDriver

with:

traversal_paths: [‘m’]

  • !SortQL
    with:

    reverse: true field: ‘score__value’ traversal_paths: [‘m’]

  • !SliceQL
    with:

    start: 0 end: 50 traversal_paths: [‘m’]

SliceQL will ensure that only the first 50 documents are returned from this Pod

Parameters
  • start (int) – Zero-based index at which to start extraction.

  • end (Optional[int]) – Zero-based index before which to end extraction. slice extracts up to but not including end. For example, take(1,4) extracts the second element through the fourth element (elements indexed 1, 2, and 3).

  • 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]