Skip to content

Commit

Permalink
Add vex extension to the list, add code comments
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Gaievski <[email protected]>
  • Loading branch information
martin-gaievski committed Jan 11, 2023
1 parent 1d38554 commit 1c81f29
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/opensearch/knn/index/util/Lucene.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ public float score(float rawScore, SpaceType spaceType) {

@Override
public List<String> mmapFileExtensions() {
return List.of("vec", "vem");
return List.of("vec", "vex");
}
}
9 changes: 9 additions & 0 deletions src/main/java/org/opensearch/knn/plugin/KNNPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,17 @@ public Collection<SystemIndexDescriptor> getSystemIndexDescriptors(Settings sett
return ImmutableList.of(new SystemIndexDescriptor(MODEL_INDEX_NAME, "Index for storing models used for k-NN indices"));
}

/**
* Plugin can provide additional node settings, that includes new settings or overrides for existing one from core.
*
* @return settings that are set by plugin
*/
@Override
public Settings additionalSettings() {
// We add engine specific extensions to the core list for HybridFS store type. We read existing values
// and append ours because in core setting will be replaced by override.
// Values are set as cluster defaults and are used at index creation time. Index specific overrides will take priority over values
// that are set here.
final List<String> engineSettings = Arrays.stream(KNNEngine.values())
.flatMap(engine -> engine.mmapFileExtensions().stream())
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void testMmapFileExtensions() {
.flatMap(engine -> engine.mmapFileExtensions().stream())
.collect(Collectors.toList());
assertNotNull(mmapExtensions);
final List<String> expectedSettings = List.of("vem", "vec");
final List<String> expectedSettings = List.of("vex", "vec");
assertTrue(expectedSettings.containsAll(mmapExtensions));
assertTrue(mmapExtensions.containsAll(expectedSettings));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void testVersion() {
public void testMmapFileExtensions() {
final List<String> luceneMmapExtensions = Lucene.INSTANCE.mmapFileExtensions();
assertNotNull(luceneMmapExtensions);
final List<String> expectedSettings = List.of("vem", "vec");
final List<String> expectedSettings = List.of("vex", "vec");
assertTrue(expectedSettings.containsAll(luceneMmapExtensions));
assertTrue(luceneMmapExtensions.containsAll(expectedSettings));
}
Expand Down

0 comments on commit 1c81f29

Please sign in to comment.