Skip to content

Commit

Permalink
try this
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelmer Kuperus committed Jan 2, 2025
1 parent e9ff171 commit 4cc6ab0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,19 @@ 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)
}
}

/**
* The ordering used to compare distances
*/
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)
}
}

/**
Expand Down

0 comments on commit 4cc6ab0

Please sign in to comment.