Attribute Sorting
Sort results by payload field values with ascending or descending order
Why do anything?
Search results need ordering beyond relevance. Users want to sort by date, price, rating, etc.
Why now?
Real applications need multiple sorting options for user control.
Why this feature?
Sort documents by any payload field with configurable order (asc/desc) and null handling.
How It Works
Sort by attribute provides deterministic ordering based on payload field values.
1
Field Extraction
Extract sort field from document payloads
2
Sorting
Apply sorting algorithm with configured order
3
Null Handling
Position null values according to config
Why This Approach
Simple, fast sorting for structured fields. Complements relevance-based ranking.
Where This Is Used
Integration
retriever = client.retrievers.create(stages=[{"type": "sort_attribute", "field": "price"}])