Skip to content

You are viewing docs for an old version. Switch to latest v30.2.

Curation ​

While Typesense makes it really easy and intuitive to deliver great search results, sometimes you might want to promote certain documents over others. Or, you might want to exclude certain documents from a query's result set.

Using overrides, you can include or exclude specific documents for a given query.

Create or update an override ​

In the following example, we are overriding the search results by placing the documents with ids 422 and 54 in the first and second positions respectively via the includes condition. Additionally, we're ensuring that the document with id 287 is not returned at all via the excludes condition. You need to specify only one of exclude or include.

Note how we are applying these overrides to an exact match of the query apple. Instead, if we want to match all queries that contained the word apple, we will use the contains match instead.

Sample Response ​

Definition ​

PUT ${TYPESENSE_HOST}/collections/:collection/overrides/:id

Arguments ​

ParameterRequiredDescription
excludesnoList of document ids that should be excluded from the search results.
includesnoList of document ids that should be included in the search results with their corresponding positions.
rule.queryyesIndicates what search queries should be overridden.
rule.matchyesIndicates whether the match on the query term should be exact or contains.

List all overrides ​

Listing all overrides associated with a given collection.

Sample Response ​

Definition ​

GET ${TYPESENSE_HOST}/collections/:collection/overrides

Retrieve an override ​

Fetch an individual override associated with a collection.

Sample Response ​

Definition ​

GET ${TYPESENSE_HOST}/collections/:collection/overrides/:id

Delete an override ​

Deleting an override associated with a collection.

Sample Response ​

Definition ​

DELETE ${TYPESENSE_HOST}/collections/:collection/overrides/:id

You are viewing docs for an old version. Switch to latest v30.2.