Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strong-dodos-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@meilisearch/instant-meilisearch": minor
---

Add vector search param to support vector search with user-provided embedding
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@ describe('Parameters adapter', () => {
expect(searchParams.hybrid).toBe(hybridSearchConfig)
})

test('vector can be set via search parameters', () => {
const vector = [0, 1, 2]

const searchParams = adaptSearchParams({
...DEFAULT_CONTEXT,
meiliSearchParams: {
vector: vector,
},
})

expect(searchParams.vector).toBe(vector)
})

test('ranking score threshold can be set via search parameters', () => {
const rankingScoreThreshold = 0.974

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ export function MeiliParamsCreator(searchContext: SearchContext) {
meiliSearchParams.hybrid = value
}
},
addVector() {
const value = overrideParams?.vector
if (value !== undefined) {
meiliSearchParams.vector = value
}
},
addDistinct() {
const value = overrideParams?.distinct
if (value !== undefined) {
Expand Down Expand Up @@ -282,6 +288,7 @@ export function adaptSearchParams(
meilisearchParams.addShowRankingScore()
meilisearchParams.addAttributesToSearchOn()
meilisearchParams.addHybridSearch()
meilisearchParams.addVector()
meilisearchParams.addDistinct()
meilisearchParams.addRankingScoreThreshold()

Expand Down