public AnnoyIndexSearchResult GetNearestToItem( ulong itemIndex, uint nResult, int searchK, bool shouldIncludeDistance) { if (_indexPtr == IntPtr.Zero) { throw new ObjectDisposedException("index"); } var searchResultPtr = NativeMethods.GetNearestToItem( _indexPtr, itemIndex, nResult, searchK, shouldIncludeDistance); try { return(AnnoyIndexSearchResult.LoadFromPtr(searchResultPtr, shouldIncludeDistance)); } finally { NativeMethods.FreeSearchResult(searchResultPtr); } }
public AnnoyIndexSearchResult GetNearest( IReadOnlyList <float> queryVector, uint nResult, int searchK, bool shouldIncludeDistance) { if (_indexPtr == IntPtr.Zero) { throw new ObjectDisposedException("index"); } var searchResultPtr = NativeMethods.GetNearest( _indexPtr, queryVector.ToArray(), nResult, searchK, shouldIncludeDistance); try { return(AnnoyIndexSearchResult.LoadFromPtr(searchResultPtr, shouldIncludeDistance)); } finally { NativeMethods.FreeSearchResult(searchResultPtr); } }