-
-
Notifications
You must be signed in to change notification settings - Fork 106
[Store] Add configurable semantic ratio to Meilisearch Store #782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[Store] Add configurable semantic ratio to Meilisearch Store #782
Conversation
This adds a semanticRatio parameter to control the balance between keyword-based (BM25) and semantic (vector) search in hybrid queries. - Add semanticRatio constructor parameter (default: 1.0 for BC) - Allow per-query override via options array - Add validation (0.0-1.0 range) - Add support for 'q' parameter in query options for BM25 text queries - Add comprehensive tests covering all scenarios Use cases: - 0.0 = Pure keyword search (IDs, codes, exact terms) - 0.5 = Balanced hybrid search (general use) - 1.0 = Pure semantic search (conceptual similarity) Backward compatible - default behavior unchanged.
5263652
to
e2d01ac
Compare
Don't forget to add the support for the option in |
0be5f6d
to
25b4785
Compare
->integerNode('dimensions')->end() | ||
->floatNode('semantic_ratio') | ||
->info('The ratio between semantic (vector) and full-text search (0.0 to 1.0). Default: 1.0 (100% semantic)') | ||
->defaultValue(1.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have ->min() and ->max(), can you please check. Unsure if we have ->between()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes @OskarStark, it is cleaner using min and max, but unfortunately, a between function doesn't exist in the symfony/config component.
- Use min/max constraints instead of custom validation callback - Remove redundant comments from meilisearch example - Clean up changelog entry
This PR drops a new configurable
semanticRatio
parameter into theMeilisearch Store
. It's all about letting you fine-tune the vibe between classic full-text search and the new-school semantic (vector) search in Meilisearch's hybrid setup.Right now, the ratio is hardcoded to
1.0
(100% semantic), which is a bit rigid. This change gives you the freedom to slide between super-precise full-text matches and more conceptual. For anyone curious about the nitty-gritty, Meilisearch has a great article on [Full-Text Search vs. Vector Search].It's fully backward-compatible, defaulting to
1.0
, so no old code gets broken.Example Usage
1. Set the vibe on instantiation:
2. Override it for a specific query:
Now end users can configure the semantic ratio in their config/packages/ai.yaml: