jina.drivers.querylang.sort¶
-
class
jina.drivers.querylang.sort.
SortQL
(field, reverse=False, traversal_paths=('c', ), *args, **kwargs)[source]¶ Bases:
jina.drivers.QuerySetReader
,jina.drivers.BaseRecursiveDriver
Sorts the incoming of the documents by the value of a given field. It can also work in reverse mode
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’]
SortQL will ensure that only the documents are sorted by the score value before slicing the first top 50 documents
- Parameters
field (
str
) – the value of the field drives the sort of the iterable docsreverse (
bool
) – sort the value from big to small