feat: add orderBy sorting and fix timestamp queries
Add production-scale sorting support with orderBy/order parameters: - Sort by any field including createdAt, updatedAt, timestamps - Works in both metadata-only and vector+metadata query paths - O(k) memory complexity where k = filtered results Fix timestamp sorting precision issue: - Load actual timestamp values from entity metadata for sorting - Avoids 1-minute bucketing precision loss - Maintains bucketing for efficient range queries Fix range query operators: - Normalize min/max bounds before comparison with bucketed index - Ensures gte, lte, gt, lt work correctly with timestamps Standardize operator syntax: - Canonical: eq, ne, gt, gte, lt, lte, in, between, contains, exists - Deprecate: is, isNot, greaterEqual, lessEqual (remove in v5.0.0) - Maintain backward compatibility with aliases Test results: All sorting and range query tests pass, no regressions
This commit is contained in:
parent
a7948d2f11
commit
97cc8fd1c7
3 changed files with 329 additions and 57 deletions
|
|
@ -180,7 +180,11 @@ export interface FindParams<T = any> {
|
|||
limit?: number // Max results (default: 10)
|
||||
offset?: number // Skip N results
|
||||
cursor?: string // Cursor-based pagination
|
||||
|
||||
|
||||
// Sorting (v4.5.4)
|
||||
orderBy?: string // Field to sort by (e.g., 'createdAt', 'title', 'metadata.priority')
|
||||
order?: 'asc' | 'desc' // Sort direction: 'asc' (default) or 'desc'
|
||||
|
||||
// Advanced options
|
||||
mode?: SearchMode // Search strategy
|
||||
explain?: boolean // Return scoring explanation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue