Skip to content

Commit 7857ebd

Browse files
committed
fix usearch for iOS
1 parent bcd67aa commit 7857ebd

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

Runtime/RAG/usearch/NativeMethods.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ namespace Cloud.Unum.USearch
1111
{
1212
public static class NativeMethods
1313
{
14+
#if UNITY_IOS
15+
private const string LibraryName = "__Internal";
16+
#else
1417
private const string LibraryName = "libusearch_c";
18+
#endif
1519

1620
[DllImport(LibraryName, CallingConvention = CallingConvention.Cdecl)]
1721
public static extern usearch_index_t usearch_init(ref IndexOptions options, out usearch_error_t error);

Runtime/RAG/usearch/USearchIndex.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,10 @@ private int Search<T>(T[] queryVector, int count, out ulong[] keys, out float[]
318318
}
319319
else
320320
{
321-
if (Application.platform == RuntimePlatform.Android)
321+
lock (filterLock)
322322
{
323-
lock (filterLock)
324-
{
325-
FilterFunction = filter;
326-
matches = checked((int)usearch_filtered_search(this._index, queryVectorPtr, scalarKind, (UIntPtr)count, StaticFilter, IntPtr.Zero, keys, distances, out error));
327-
}
328-
}
329-
else
330-
{
331-
matches = checked((int)usearch_filtered_search(this._index, queryVectorPtr, scalarKind, (UIntPtr)count, (int key, IntPtr state) => filter(key), IntPtr.Zero, keys, distances, out error));
323+
FilterFunction = filter;
324+
matches = checked((int)usearch_filtered_search(this._index, queryVectorPtr, scalarKind, (UIntPtr)count, StaticFilter, IntPtr.Zero, keys, distances, out error));
332325
}
333326
}
334327
HandleError(error);

0 commit comments

Comments
 (0)