Skip to content

Commit af410a5

Browse files
committed
Fix style error
Signed-off-by: Vijayan B <[email protected]>
1 parent 9af0757 commit af410a5

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/main/java/org/opensearch/knn/index/mapper/CompressionLevel.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ public static boolean isConfigured(CompressionLevel compressionLevel) {
108108
* is invalid.
109109
*/
110110
public RescoreContext getDefaultRescoreContext(Mode mode, int dimension, Version version) {
111-
//TODO move this to separate class called resolver to resolve rescore context
111+
// TODO move this to separate class called resolver to resolve rescore context
112112
if (modesForRescore.contains(mode)) {
113-
if( this == x4 && version.before(Version.V_3_1_0)){
113+
if (this == x4 && version.before(Version.V_3_1_0)) {
114114
// For index created before 3.1, context was always null and mode is empty
115115
return null;
116116
}
117-
// Adjust RescoreContext based on dimension
118-
if (dimension <= RescoreContext.DIMENSION_THRESHOLD) {
117+
// Adjust RescoreContext based on dimension except for 4x compression
118+
if (this != x4 && dimension <= RescoreContext.DIMENSION_THRESHOLD) {
119119
// For dimensions <= 1000, return a RescoreContext with 5.0f oversample factor
120120
return RescoreContext.builder()
121121
.oversampleFactor(RescoreContext.OVERSAMPLE_FACTOR_BELOW_DIMENSION_THRESHOLD)
@@ -128,7 +128,7 @@ public RescoreContext getDefaultRescoreContext(Mode mode, int dimension, Version
128128
}
129129

130130
@VisibleForTesting
131-
RescoreContext getDefaultRescoreContext(Mode mode, int dimension){
131+
RescoreContext getDefaultRescoreContext(Mode mode, int dimension) {
132132
return getDefaultRescoreContext(mode, dimension, Version.CURRENT);
133133
}
134134

src/test/java/org/opensearch/knn/index/mapper/CompressionLevelTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void testGetDefaultRescoreContext() {
9393
// x4 with dimension <= 1000 should have an oversample factor of 5.0f
9494
rescoreContext = CompressionLevel.x4.getDefaultRescoreContext(mode, belowThresholdDimension);
9595
assertNotNull(rescoreContext);
96-
assertEquals(5.0f, rescoreContext.getOversampleFactor(), 0.0f);
96+
assertEquals(1.0f, rescoreContext.getOversampleFactor(), 0.0f);
9797
assertTrue(rescoreContext.isRescoreEnabled());
9898
assertFalse(rescoreContext.isUserProvided());
9999
// x4 with dimension > 1000 should have an oversample factor of 1.0f

src/test/java/org/opensearch/knn/integ/ModeAndCompressionIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ private void validateSearch(
650650
String exactSearchResponseBody = EntityUtils.toString(exactSearchResponse.getEntity());
651651
List<Float> exactSearchKnnResults = parseSearchResponseScore(exactSearchResponseBody, FIELD_NAME);
652652
assertEquals(NUM_DOCS, exactSearchKnnResults.size());
653-
if(Mode.ON_DISK.getName().equals(mode)){
653+
if (Mode.ON_DISK.getName().equals(mode)) {
654654
Assert.assertEquals(exactSearchKnnResults, knnResults);
655655
}
656656

0 commit comments

Comments
 (0)