feat(search): expose meilisearch binaryQuantized for vector embeddings - #3055
feat(search): expose meilisearch binaryQuantized for vector embeddings#3055NoiceHax wants to merge 1 commit into
Conversation
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 SummaryThis PR adds an opt-in environment variable for Meilisearch binary vector quantization and includes the setting in embedder drift detection and configuration.
Confidence Score: 4/5The 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
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 |
| @@ -275,6 +277,7 @@ export class MeiliSearchVectorProvider implements PluginProvider<VectorStoreClie | |||
| default: { | |||
| source: "userProvided", | |||
| dimensions: desiredDimensions, | |||
| binaryQuantized: desiredBinaryQuantized, | |||
| }, | |||
There was a problem hiding this 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.
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.| // 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"), |
There was a problem hiding this comment.
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!
What does this PR do?
Exposes Meilisearch binary quantization for the vector index behind a new opt-in
MEILI_BINARY_QUANTIZEDenv var (defaultfalse). Binary-quantized vectors use ~3% of the space with a large speedup at a small recall cost, per the issue.Changes
MEILI_BINARY_QUANTIZEDenv var ("true"/"false", default"false"— current behavior unchanged unless opted in)binaryQuantizedin theuserProvidedembedder config, with drift detection so flipping the var reconfigures the index on next startupFixes #1315