SearchBuilder

DSL for search (/points/query). Provide a query (vector, id, fusion, order-by, sample) and/or one or more prefetch sub-requests, plus a positive limit.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
var limit: Int

Maximum number of hits to return.

Link copied to clipboard
var offset: Int?

Number of hits to skip (paging; costly for large offsets).

Link copied to clipboard

Drop hits scoring below this threshold.

Link copied to clipboard

Search only the shards holding this key. null (default) searches every shard.

Link copied to clipboard

Name of the vector to search when the collection has named vectors.

Link copied to clipboard

Which payload to return (defaults to the server's behavior).

Link copied to clipboard

Whether to return the stored vectors.

Functions

Link copied to clipboard
fun context(configure: ContextBuilder.() -> Unit)

Context search: steer results by positive/negative example pairs, without a target.

Link copied to clipboard
fun dbsf()

Distribution-Based Score Fusion over the prefetch sources.

Link copied to clipboard
fun discover(configure: DiscoverBuilder.() -> Unit)

Guided (discovery) search: rank by a target, constrained by context example pairs.

Link copied to clipboard
fun filter(filter: Filter)

Restrict the search to points matching an already-built Filter — for filters produced by a translator.

fun filter(configure: FilterBuilder.() -> Unit)

Restrict the search to points matching this filter.

Link copied to clipboard
fun formula(expression: Expression, defaults: Map<String, JsonPrimitive> = emptyMap())

Rescore the candidates with an arithmetic formula rather than by distance. Pair it with prefetch to narrow the candidates first: a formula over the whole collection is a full scan.

Link copied to clipboard
fun lookupFrom(collection: String, vector: String? = null)

Look up query-by-id vectors from another collection.

Link copied to clipboard
fun mmr(diversity: Float? = null, candidatesLimit: Int? = null)

Rerank with Maximal Marginal Relevance, trading some relevance for variety. Applies to a vector query and is rejected on any other kind, because MMR needs the query vector to measure dissimilarity against.

Link copied to clipboard
fun orderBy(key: String, direction: Direction? = null)

Order points by a payload key.

Link copied to clipboard
fun params(configure: SearchParamsBuilder.() -> Unit)

Tune the accuracy/speed trade-off.

Link copied to clipboard
fun prefetch(configure: PrefetchBuilder.() -> Unit)

Add a prefetch sub-request (repeatable; prefetches may nest for multi-stage retrieval).

Link copied to clipboard
fun query(id: PointId)

Search by the stored vector of an existing point (a "more like this" query).

fun query(query: QueryInterface)

Set the query directly (e.g. a prebuilt QueryInterface).

fun query(values: List<Float>)
fun query(vararg values: Float)

Search by an explicit dense query vector.

Link copied to clipboard
fun queryDocument(text: String, model: String, options: Map<String, JsonElement>? = null)

Search by text the server embeds with model, instead of by a vector the caller computed. Needs a Qdrant with an inference provider configured. See InferenceInput.

Link copied to clipboard
fun queryMulti(vectors: List<List<Float>>)

Search by a multi-vector / late-interaction (ColBERT) query.

Link copied to clipboard
fun querySparse(indices: List<Int>, values: List<Float>)

Search by a sparse query vector (set using to the sparse vector's name).

Link copied to clipboard
fun recommend(configure: RecommendBuilder.() -> Unit)

Recommend points close to positive examples and far from negative ones.

Link copied to clipboard
fun rrf(k: Int? = null, weights: List<Float>? = null)

Reciprocal Rank Fusion over the prefetch sources — hybrid search.

Link copied to clipboard
fun sample()

Return a random sample of points.