Skip to content

Fix: Keep a one-vector server request as one row - #834

Closed
Tyagiquamar wants to merge 1 commit into
unum-cloud:main-devfrom
Tyagiquamar:fix/server-one-vector-row
Closed

Tyagiquamar wants to merge 1 commit into
unum-cloud:main-devfrom
Tyagiquamar:fix/server-one-vector-row

Conversation

@Tyagiquamar

Copy link
Copy Markdown
Contributor

Summary

usearch.server add_one and search_one now pass one vector as a single row. A length-d request is indexed and searched as one d-dimensional vector.

Root Cause

Both handlers reshaped the request with reshape(vector.shape[0], 1). For a vector of length d that builds a (d, 1) matrix. Index.add and Index.search treat a 2D array as one row per vector, so the call became d vectors of dimension 1 instead of one vector of dimension d. A normal flat query never matched the index dimensionality.

Fix

_one_vector flattens a 1D array, or a 2D array with a single row or a single column, into one contiguous vector. add_one and search_one pass that vector through. Index.add and Index.search already turn a 1D vector into a (1, d) row.

Test Plan

  • python -m pytest python/scripts/test_server_vector.py -q -p no:cacheprovider --override-ini "addopts="
  • Result: 2 passed in 4.91s (Python 3.14.5, NumPy 2.4.6, Windows).
  • The test executes _one_vector and checks that the handlers no longer contain the column reshape. It does not import the compiled extension or start ucall. No C++ build was run.

add_one and search_one reshaped a length-d vector into d one-dimensional rows.
@ashvardanian

ashvardanian commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

@Tyagiquamar, thanks for the fix! usearch.server didn't carry over into 3.0; serving over the network now belongs to UCall, our low-latency client-server engine. It speaks plain HTTP, so it works with any web server or client, and it batches requests on the server side, which suits vector search well. The UCall Python docs show a batched endpoint, and the USearch Python docs the new SDK. Closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants