Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ All notable changes to this project are documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). See the [CONTRIBUTING guide](./CONTRIBUTING.md#Changelog) for instructions on how to add changelog entries.

## [Unreleased 3.2](https://github.com/opensearch-project/k-NN/compare/main...HEAD)
## Bug Fixes

* Reverts k back to null in radial search with filter rewrite [#2915](https://github.com/opensearch-project/k-NN/pull/2915)
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,11 @@ protected QueryBuilder doRewrite(QueryRewriteContext queryShardContext) throws I
if (Objects.nonNull(filter)) {
rewrittenFilter = filter.rewrite(queryShardContext);
if (rewrittenFilter != filter) {
Integer optionalK = this.k == 0 ? null : this.k;
KNNQueryBuilder rewrittenQueryBuilder = KNNQueryBuilder.builder()
.fieldName(this.fieldName)
.vector(this.vector)
.k(this.k)
.k(optionalK)
.maxDistance(this.maxDistance)
.minScore(this.minScore)
.methodParameters(this.methodParameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ public void testDoToQuery_whenDoRadiusSearch_whenDistanceThreshold_whenFilter_th
org.opensearch.knn.common.KNNConstants.METHOD_HNSW,
ImmutableMap.of()
);
knnQueryBuilder = (KNNQueryBuilder) knnQueryBuilder.doRewrite(mockQueryShardContext);
KNNMethodContext knnMethodContext = new KNNMethodContext(KNNEngine.LUCENE, SpaceType.L2, methodComponentContext);
when(mockKNNVectorField.getKnnMappingConfig()).thenReturn(getMappingConfigForMethodMapping(knnMethodContext, 4));
when(mockQueryShardContext.fieldMapper(anyString())).thenReturn(mockKNNVectorField);
Expand Down
Loading