Skip to content

Commit 5a1811f

Browse files
Update C-API [e196f0f2 -> 4.0.0]
1 parent e9ee0c9 commit 5a1811f

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

objectbox/lib/src/native/bindings/objectbox-sync.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "objectbox.h"
3535

3636
#if defined(static_assert) || defined(__cplusplus)
37-
static_assert(OBX_VERSION_MAJOR == 0 && OBX_VERSION_MINOR == 21 && OBX_VERSION_PATCH == 0, // NOLINT
37+
static_assert(OBX_VERSION_MAJOR == 4 && OBX_VERSION_MINOR == 0 && OBX_VERSION_PATCH == 0, // NOLINT
3838
"Versions of objectbox.h and objectbox-sync.h files do not match, please update");
3939
#endif
4040

objectbox/lib/src/native/bindings/objectbox.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ extern "C" {
5151

5252
/// When using ObjectBox as a dynamic library, you should verify that a compatible version was linked using
5353
/// obx_version() or obx_version_is_at_least().
54-
#define OBX_VERSION_MAJOR 0
55-
#define OBX_VERSION_MINOR 21
54+
#define OBX_VERSION_MAJOR 4
55+
#define OBX_VERSION_MINOR 0
5656
#define OBX_VERSION_PATCH 0 // values >= 100 are reserved for dev releases leading to the next minor/major increase
5757

5858
//----------------------------------------------
@@ -2032,6 +2032,11 @@ OBX_C_API OBX_bytes_score_array* obx_query_find_with_scores(OBX_query* query);
20322032
/// The resulting array is sorted by score in ascending order (unlike obx_query_find_ids()).
20332033
OBX_C_API OBX_id_score_array* obx_query_find_ids_with_scores(OBX_query* query);
20342034

2035+
/// Find object IDs matching the query ordered by their query score (e.g. distance in NN search).
2036+
/// The resulting array is sorted by score in ascending order (unlike obx_query_find_ids()).
2037+
/// Unlike obx_query_find_ids_with_scores(), this method returns a simple array of IDs without scores.
2038+
OBX_C_API OBX_id_array* obx_query_find_ids_by_score(OBX_query* query);
2039+
20352040
/// Find the first object matching the query.
20362041
/// @returns OBX_NOT_FOUND if no object matches.
20372042
/// The exposed data comes directly from the OS to allow zero-copy access, which limits the data lifetime:

objectbox/lib/src/native/bindings/objectbox_c.dart

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5189,6 +5189,24 @@ class ObjectBoxC {
51895189
_query_find_ids_with_scoresPtr.asFunction<
51905190
ffi.Pointer<OBX_id_score_array> Function(ffi.Pointer<OBX_query>)>();
51915191

5192+
/// Find object IDs matching the query ordered by their query score (e.g. distance in NN search).
5193+
/// The resulting array is sorted by score in ascending order (unlike obx_query_find_ids()).
5194+
/// Unlike obx_query_find_ids_with_scores(), this method returns a simple array of IDs without scores.
5195+
ffi.Pointer<OBX_id_array> query_find_ids_by_score(
5196+
ffi.Pointer<OBX_query> query,
5197+
) {
5198+
return _query_find_ids_by_score(
5199+
query,
5200+
);
5201+
}
5202+
5203+
late final _query_find_ids_by_scorePtr = _lookup<
5204+
ffi.NativeFunction<
5205+
ffi.Pointer<OBX_id_array> Function(
5206+
ffi.Pointer<OBX_query>)>>('obx_query_find_ids_by_score');
5207+
late final _query_find_ids_by_score = _query_find_ids_by_scorePtr
5208+
.asFunction<ffi.Pointer<OBX_id_array> Function(ffi.Pointer<OBX_query>)>();
5209+
51925210
/// Find the first object matching the query.
51935211
/// @returns OBX_NOT_FOUND if no object matches.
51945212
/// The exposed data comes directly from the OS to allow zero-copy access, which limits the data lifetime:
@@ -10610,9 +10628,9 @@ class OBX_dart_finalizer extends ffi.Opaque {}
1061010628
typedef obx_dart_closer
1061110629
= ffi.NativeFunction<obx_err Function(ffi.Pointer<ffi.Void> native_object)>;
1061210630

10613-
const int OBX_VERSION_MAJOR = 0;
10631+
const int OBX_VERSION_MAJOR = 4;
1061410632

10615-
const int OBX_VERSION_MINOR = 21;
10633+
const int OBX_VERSION_MINOR = 0;
1061610634

1061710635
const int OBX_VERSION_PATCH = 0;
1061810636

0 commit comments

Comments
 (0)