Skip to content

Commit f5df7a3

Browse files
committed
feat: add a helper for sorting by object's UUID
1 parent 1e3304b commit f5df7a3

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

  • src/main/java/io/weaviate/client6/v1/api/collections/query

src/main/java/io/weaviate/client6/v1/api/collections/query/SortBy.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@ public static SortBy property(String property) {
1212
return new SortBy(List.of(property), true);
1313
}
1414

15+
/**
16+
* Sort by object's UUID. Ascending order by default.
17+
*
18+
* <p>
19+
* Sorting by UUID may be useful if objects are assigned
20+
* custom UUIDv7 at ingestion, as those are "time-ordered".
21+
*
22+
* <p>
23+
* It may be less useful for the auto-generated UUIDs,
24+
* which will produce an essentialy random, albeit stable, order.
25+
*
26+
* @see #desc() to sort in descending order.
27+
*/
28+
public static SortBy uuid() {
29+
return property(ById.ID_PROPERTY);
30+
}
31+
1532
/**
1633
* Sort by object creation time. Ascending order by default.
1734
*

0 commit comments

Comments
 (0)