Require exact query length in Python and JNI bindings

Oversized query arrays can panic in core distance functions. Change
length checks from < to != so both short and long arrays are rejected
as ValueError (Python) or RuntimeException (JNI) instead of crashing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
diff --git a/jni/src/lib.rs b/jni/src/lib.rs
index 7ada63b..b55ad31 100644
--- a/jni/src/lib.rs
+++ b/jni/src/lib.rs
@@ -275,10 +275,10 @@
         Ok(l) => l as usize,
         Err(e) => return throw_and_return(&mut env, &format!("get_array_length: {}", e)),
     };
-    if query_len < d {
+    if query_len != d {
         return throw_and_return(
             &mut env,
-            &format!("query array too short: {} < d={}", query_len, d),
+            &format!("query array length {} != d={}", query_len, d),
         );
     }
 
@@ -381,10 +381,10 @@
         Ok(l) => l as usize,
         Err(e) => return throw_and_return(&mut env, &format!("get_array_length: {}", e)),
     };
-    if query_len < nq * d {
+    if query_len != nq * d {
         return throw_and_return(
             &mut env,
-            &format!("queries array too short: {} < nq*d={}", query_len, nq * d),
+            &format!("queries array length {} != nq*d={}", query_len, nq * d),
         );
     }
 
diff --git a/python/src/lib.rs b/python/src/lib.rs
index 66a68a3..52204d9 100644
--- a/python/src/lib.rs
+++ b/python/src/lib.rs
@@ -108,9 +108,9 @@
     ) -> PyResult<(Bound<'py, PyArray1<i64>>, Bound<'py, PyArray1<f32>>)> {
         let query_slice = query.as_slice()?;
 
-        if query_slice.len() < self.inner.d {
+        if query_slice.len() != self.inner.d {
             return Err(pyo3::exceptions::PyValueError::new_err(format!(
-                "query length {} < index dimension {}",
+                "query length {} != index dimension {}",
                 query_slice.len(),
                 self.inner.d
             )));