From 50e23088d4fd33d02747f55bf1319451db6d6682 Mon Sep 17 00:00:00 2001 From: Taewoon Kim Date: Mon, 26 Oct 2026 10:03:24 +0900 Subject: [PATCH] Native glue: return rerank_oversample and fused_pq from the vector index metadata when the engine has them The native vector-index metadata op listed a fixed set of fields, so VectorIndex.get_metadata() never carried rerank_oversample and fused_pq on an image linked against ArcadeDB 26.11.1 (ArcadeData/arcadedb#10545), although the JVM wrapper returns them. The glue reads them from the index's own definition JSON (LSMVectorIndex.toJSON writes every knob the linked engine's metadata has), so it still compiles and links against 26.10.2, where the keys stay out, which the Python side already expects (_OPTIONAL_METADATA_KEYS). Co-Authored-By: Claude Sonnet 5.5 --- .../main/java/org/humemai/nativelib/NativeExtras.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/native/src/main/java/org/humemai/nativelib/NativeExtras.java b/native/src/main/java/org/humemai/nativelib/NativeExtras.java index 825dc1e..0ef8336 100644 --- a/native/src/main/java/org/humemai/nativelib/NativeExtras.java +++ b/native/src/main/java/org/humemai/nativelib/NativeExtras.java @@ -44,6 +44,7 @@ import com.arcadedb.index.TypeIndex; import com.arcadedb.index.vector.LSMVectorIndex; import com.arcadedb.schema.LSMVectorIndexMetadata; +import com.arcadedb.serializer.json.JSONObject; import com.arcadedb.utility.Pair; import com.arcadedb.function.sql.SQLFunctionAbstract; import com.arcadedb.graph.Edge; @@ -323,6 +324,14 @@ public static CCharPointer vindex(final IsolateThread thread, final long dbh, fi sb.append(",\"add_hierarchy\":").append(m.addHierarchy).append(",\"build_state\":").append(q(m.buildState)); sb.append(",\"pq_subspaces\":").append(m.pqSubspaces).append(",\"pq_clusters\":").append(m.pqClusters); sb.append(",\"pq_center_globally\":").append(m.pqCenterGlobally).append(",\"pq_training_limit\":").append(m.pqTrainingLimit); + // rerankOversample and fusedPQ exist from engine 26.11.1 (ArcadeData/arcadedb#10545). The index's own definition JSON writes every knob the + // engine's metadata has, so the keys appear exactly when the linked engine has them and stay out for 26.10.2, and this class names no field + // that 26.10.2 lacks (it compiles and links against both). + final JSONObject definition = first.toJSON(); + if (definition.has("rerankOversample")) + sb.append(",\"rerank_oversample\":").append(definition.getInt("rerankOversample")); + if (definition.has("fusedPQ")) + sb.append(",\"fused_pq\":").append(definition.getBoolean("fusedPQ")); } case "approximate" -> { final List vector = (List) a.get("vector");