diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index b1b78afc4711..cc6edaa22120 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -185,6 +185,8 @@ Other * GITHUB#13077: Add public getter for SynonymQuery#field (Andrey Bozhko) +* GITHUB#13393: Add support for reloading the SPI for KnnVectorsFormat class (Navneet Verma) + ======================== Lucene 9.10.0 ======================= API Changes diff --git a/lucene/core/src/java/org/apache/lucene/codecs/KnnVectorsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/KnnVectorsFormat.java index 6d84323f3169..5ce270fa372c 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/KnnVectorsFormat.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/KnnVectorsFormat.java @@ -68,6 +68,19 @@ public String getName() { return name; } + /** + * Reloads the KnnVectorsFormat list from the given {@link ClassLoader}. + * + *

NOTE: Only new KnnVectorsFormat are added, existing ones are never removed or + * replaced. + * + *

This method is expensive and should only be called for discovery of new KnnVectorsFormat + * on the given classpath/classloader! + */ + public static void reloadKnnVectorsFormat(ClassLoader classloader) { + Holder.getLoader().reload(classloader); + } + /** looks up a format by name */ public static KnnVectorsFormat forName(String name) { return Holder.getLoader().lookup(name);