From 4cc6ab0eceb928877e50ff320f4ba642ed0f4bef Mon Sep 17 00:00:00 2001 From: Jelmer Kuperus Date: Thu, 2 Jan 2025 09:13:56 +0100 Subject: [PATCH] try this --- .github/workflows/ci.yml | 6 ++---- .../com/github/jelmerk/knn/scalalike/hnsw/HnswIndex.scala | 8 ++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0187359..1d0d331 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,15 +4,13 @@ permissions: checks: write on: - pull_request: - paths-ignore: - - '**.md' push: branches-ignore: - '!master' tags-ignore: - 'v[0-9]+.[0-9]+.[0-9]+' - + paths-ignore: + - '**.md' jobs: ci-pipeline: runs-on: ubuntu-22.04 diff --git a/hnswlib-scala/src/main/scala/com/github/jelmerk/knn/scalalike/hnsw/HnswIndex.scala b/hnswlib-scala/src/main/scala/com/github/jelmerk/knn/scalalike/hnsw/HnswIndex.scala index 2dbda75..5e32e74 100644 --- a/hnswlib-scala/src/main/scala/com/github/jelmerk/knn/scalalike/hnsw/HnswIndex.scala +++ b/hnswlib-scala/src/main/scala/com/github/jelmerk/knn/scalalike/hnsw/HnswIndex.scala @@ -155,7 +155,9 @@ class HnswIndex[TId, TVector, TItem <: Item[TId, TVector], TDistance] private (d */ val distanceFunction: DistanceFunction[TVector, TDistance] = delegate.getDistanceFunction match { case a: ScalaDistanceFunctionAdapter[TVector, TDistance] => a.scalaFunction - case f => (v1: TVector, v2: TVector) => f.distance(v1, v2) + case f => new DistanceFunction[TVector, TDistance] { + override def apply(v1: TVector, v2: TVector): TDistance = f.distance(v1, v2) + } } /** @@ -163,7 +165,9 @@ class HnswIndex[TId, TVector, TItem <: Item[TId, TVector], TDistance] private (d */ val distanceOrdering: Ordering[TDistance] = delegate.getDistanceComparator match { case ordering: Ordering[TDistance] => ordering - case c => (x: TDistance, y: TDistance) => c.compare(x, y) + case c => new Ordering[TDistance] { + override def compare(x: TDistance, y: TDistance): Int = c.compare(x, y) + } } /**