Skip to content

feat(search): expose meilisearch binaryQuantized for vector embeddings - #3055

Open
NoiceHax wants to merge 1 commit into
karakeep-app:mainfrom
NoiceHax:fix/issue-1315
Open

feat(search): expose meilisearch binaryQuantized for vector embeddings#3055
NoiceHax wants to merge 1 commit into
karakeep-app:mainfrom
NoiceHax:fix/issue-1315

Conversation

@NoiceHax

@NoiceHax NoiceHax commented Sep 4, 2026

Copy link
Copy Markdown

What does this PR do?

Exposes Meilisearch binary quantization for the vector index behind a new opt-in MEILI_BINARY_QUANTIZED env var (default false). Binary-quantized vectors use ~3% of the space with a large speedup at a small recall cost, per the issue.

Changes

  • MEILI_BINARY_QUANTIZED env var ("true"/"false", default "false" — current behavior unchanged unless opted in)
  • Passed as binaryQuantized in the userProvided embedder config, with drift detection so flipping the var reconfigures the index on next startup
  • Requires Meilisearch >= 1.12; the plugin already requires >= 1.13 for embeddings, so no new version gate needed

Fixes #1315

Binary quantization keeps 1 bit per embedding dimension (~32x smaller
index, much faster search) at a small recall cost — ideal for cheaper
hardware. Previously there was no way to enable it.

Adds opt-in MEILI_BINARY_QUANTIZED env var (default false, so current
behavior is unchanged) and threads it through the vector index's
embedder configuration, including drift detection so flipping the var
reconfigures the index on next startup. Requires Meilisearch >= 1.12;
the plugin already requires >= 1.13 for embeddings.

Fixes karakeep-app#1315
@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds an opt-in environment variable for Meilisearch binary vector quantization and includes the setting in embedder drift detection and configuration.

  • Defaults to the existing unquantized behavior.
  • Reconfigures the user-provided embedder when the desired quantization state differs.
  • Needs explicit handling and documentation for the irreversible enabled-to-disabled transition.

Confidence Score: 4/5

The PR should not merge until disabling previously enabled binary quantization is handled explicitly instead of silently retaining configuration drift.

One realistic configuration transition is broken: after quantization has been enabled, returning the variable to its default false value triggers an unsupported update whose failure is logged and ignored.

Files Needing Attention: packages/plugins/vectorstore-meilisearch/src/index.ts, packages/plugins/vectorstore-meilisearch/src/env.ts

Important Files Changed

Filename Overview
packages/plugins/vectorstore-meilisearch/src/env.ts Adds strict parsing and a false default for the new binary-quantization option, but does not accompany the user-facing setting with configuration documentation.
packages/plugins/vectorstore-meilisearch/src/index.ts Propagates binary quantization into embedder configuration, but incorrectly treats the irreversible true-to-false transition as an ordinary update and suppresses its failure.
Prompt To Fix All With AI
### Issue 1
packages/plugins/vectorstore-meilisearch/src/index.ts:270-281
**Quantization cannot be disabled**

After binary quantization has been enabled, resetting or removing `MEILI_BINARY_QUANTIZED` makes this drift check attempt to set `binaryQuantized` back to `false`. Meilisearch rejects this irreversible transition, but the surrounding catch only logs the failure. Initialization therefore continues with a quantized index even though the configuration says otherwise, and every later startup repeats the failed update. Handle this transition explicitly or recreate the embedder or index when disabling quantization.

### Issue 2
packages/plugins/vectorstore-meilisearch/src/env.ts:13-18
**Option is undocumented**

This adds a user-facing deployment setting without adding it to the configuration documentation. Operators who rely on the environment-variable reference cannot discover how to enable the feature or understand its accepted values, default, Meilisearch version requirement, recall tradeoff, and irreversible behavior.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat(search): expose meilisearch binaryQ..." | Re-trigger Greptile

Comment on lines 270 to 281
@@ -275,6 +277,7 @@ export class MeiliSearchVectorProvider implements PluginProvider<VectorStoreClie
default: {
source: "userProvided",
dimensions: desiredDimensions,
binaryQuantized: desiredBinaryQuantized,
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Quantization cannot be disabled

After binary quantization has been enabled, resetting or removing MEILI_BINARY_QUANTIZED makes this drift check attempt to set binaryQuantized back to false. Meilisearch rejects this irreversible transition, but the surrounding catch only logs the failure. Initialization therefore continues with a quantized index even though the configuration says otherwise, and every later startup repeats the failed update. Handle this transition explicitly or recreate the embedder or index when disabling quantization.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/plugins/vectorstore-meilisearch/src/index.ts
Line: 270-281

Comment:
**Quantization cannot be disabled**

After binary quantization has been enabled, resetting or removing `MEILI_BINARY_QUANTIZED` makes this drift check attempt to set `binaryQuantized` back to `false`. Meilisearch rejects this irreversible transition, but the surrounding catch only logs the failure. Initialization therefore continues with a quantized index even though the configuration says otherwise, and every later startup repeats the failed update. Handle this transition explicitly or recreate the embedder or index when disabling quantization.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +13 to +18
// Store vectors binary-quantized (1 bit per dimension, ~32x smaller,
// faster search, small recall loss). Requires Meilisearch >= 1.12.
MEILI_BINARY_QUANTIZED: z
.enum(["true", "false"])
.default("false")
.transform((v) => v === "true"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Option is undocumented

This adds a user-facing deployment setting without adding it to the configuration documentation. Operators who rely on the environment-variable reference cannot discover how to enable the feature or understand its accepted values, default, Meilisearch version requirement, recall tradeoff, and irreversible behavior.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/plugins/vectorstore-meilisearch/src/env.ts
Line: 13-18

Comment:
**Option is undocumented**

This adds a user-facing deployment setting without adding it to the configuration documentation. Operators who rely on the environment-variable reference cannot discover how to enable the feature or understand its accepted values, default, Meilisearch version requirement, recall tradeoff, and irreversible behavior.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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.

Fr: expose binaryQuantized of meilisearch (faster search and lighter db)

1 participant