ORDER BY...LIMIT:
- All
ORDER BYfields must be indexed. If they are text fields, they must use the literal tokenizer. - At least one ParadeDB text search operator must be present at the same level as the
ORDER BY...LIMIT. - The query must have a
LIMIT. - With the exception of
lower, ordering by expressions is not supported — only the raw fields themselves.
Custom Scan with a TopNScanExecState in the EXPLAIN output:
Expected Response
Expected Response
TopNScanExecState in the EXPLAIN output.
Tiebreaker Sorting
To guarantee stable sorting in the event of a tie, additional columns can be provided toORDER BY:
ParadeDB is currently able to handle 3
ORDER BY columns. If there are more
than 3 columns, the ORDER BY will not be efficiently executed by ParadeDB.Sorting by Text
If a text field is present in theORDER BY clause, it must be indexed with the literal tokenizer.
The reason is that the literal tokenizer preserves the original text, which is necessary for accurate sorting.
Sorting by lowercase text using lower(<text_field>) is also supported. To enable this, first ensure that lower(<text_field>) is indexed with the literal tokenizer.
See indexing expressions for more information.