QueryContents, the service embeds the text first (the index needs an EmbeddingModel). With Text, the query becomes hybrid: BM25 full-text ranking is fused with the vector ranking.
input is either QueryParams (sent as JSON) or BinaryQueryParams (vectors sent as binary, faster for large batches).
Parameters
QueryParams
Optional scalar fields are pointers: leave themnil to use the service default.
BinaryQueryParams
The same fields asQueryParams, except:
QueryVectors [][]float32replacesQueryVectorandBatchQueryVectors.- There is no
QueryContents.
Returns
*QueryResponse, whose Results holds exactly one of:
Results.ArrayOfQueryResultItem(*[]QueryResultItem): one query vector.Results.ArrayOfArrayOfQueryResultItem(*[][]QueryResultItem): two or more query vectors.
Result fields
Query never returns vectors or contents, even when they’re listed in Include. To read them, pass the result IDs to Get.
Errors
*ValidationError
*ValidationError
- Wraps
ErrEmptyQueryVectors,ErrInconsistentDimension, orErrUnsupportedQueryType. ABinaryQueryParamshas no vectors or vectors of different lengths, orinputis another type. Returned before any request is sent. - The service rejects the query (HTTP
400/422): no query input, wrong vector dimension,Texton an index without full-text fields, or an out-of-rangeAlpha,RrfK, orWindowMult. Other numeric parameters aren’t range-checked.
*AuthenticationError
*AuthenticationError
The
apiKey is invalid (HTTP 401).*ServiceError / *TransportError
*ServiceError / *TransportError
The service returns
5xx or can’t be reached.Example Usage
Single vector
Batch of vectors
BinaryQueryParams
Text, embedded by the service
Hybrid (BM25 + vector)
The index needs at least one full-text field, set withTextFields or FullText in CreateIndex.