Skip to content

Commit 74db753

Browse files
committed
Fixed exact cosine distance for OpenSearch 2.19+
1 parent 72e49d3 commit 74db753

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
elasticsearch: 7.17.22
2424
- ruby: 3.3
2525
gemfile: gemfiles/opensearch3.gemfile
26-
opensearch: 2.16.0
26+
opensearch: 2.19.1
2727
- ruby: 3.2
2828
gemfile: gemfiles/opensearch2.gemfile
2929
opensearch: 2.0.0

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 5.4.1 (unreleased)
2+
3+
- Fixed exact cosine distance for OpenSearch 2.19+
4+
15
## 5.4.0 (2024-09-04)
26

37
- Added `knn` option

lib/searchkick/query.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ def set_knn(payload, knn, per_page, offset)
934934
space_type: space_type
935935
}
936936
},
937-
boost: distance == "cosine" ? 0.5 : 1.0
937+
boost: distance == "cosine" && Searchkick.server_below?("2.19.0", true) ? 0.5 : 1.0
938938
}
939939
}
940940
else

0 commit comments

Comments
 (0)