jina.drivers.querylang.sort¶
-
class
jina.drivers.querylang.sort.
SortQL
(field, reverse=False, traversal_paths=('r'), *args, **kwargs)[source]¶ Bases:
jina.drivers.QuerySetReader
,jina.drivers.ContextAwareRecursiveMixin
,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
- param field
the value of the field drives the sort of the iterable docs
- param reverse
sort the value from big to small
- param traversal_paths
the traversal paths
- 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]¶