Repository navigation
Add custom_headers client option for inline rule preview metadata - #719
Open
ammadakram wants to merge 1 commit into
Open
ammadakram wants to merge 1 commit into
ammadakram wants to merge 1 commit into
Conversation
Meilisearch v1.55 returns metadata.inlineRuleConditionOutcomes only when the request sends Meili-Include-Metadata: true. inline_rule already passes through search and multi_search options, but the client had no way to send that header. Client options now accept custom_headers, which are added to every request made by the client and its indexes. Keys and values are sent as strings, so `'Meili-Include-Metadata' => true` works. Closes meilisearch#714 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
Fixes #714
What does this PR do?
inline_rule:already passes throughindex.searchandclient.multi_searchoptions asinlineRule, becauseUtils.transform_attributescamelizes only top-level keys. Field names inside the rule, such asstock_intent, are sent unchanged.metadata.inlineRuleConditionOutcomesis only returned when the request sendsMeili-Include-Metadata: true, and the client had no way to send it. This PR adds acustom_headersclient option. The headers are added to every request made by the client and its indexes. Keys and values are sent as strings, so'Meili-Include-Metadata' => trueworks:This matches how meilisearch-python handled the same issue (
custom_headers={"Meili-Include-Metadata": "true"}, #1284/#1286).Tests
spec/meilisearch/index/search/inline_rule_spec.rbcovers search withinline_rule, the condition outcomes inmetadata, and multi-search where only the query that sendsinline_rulegets outcomes. It needs Enterprise withdynamicSearchRules, which the CI image provides.spec/meilisearch_spec.rbhas a unit test forcustom_headers(a symbol key, a boolean value andnil) that needs no running server.Note:
spec/meilisearch/client/experimental_features_spec.rbleaves every experimental feature switched on, so the order of a local run sometimes breakssettings_spec.rbdefault-value examples. This also happens onmainand is unrelated to this PR.AI assistance
Per the "Coding with AI" section: I used Claude (Anthropic) to explore the codebase and to draft the implementation and specs. I then ran two automated review passes, which caught the boolean-header crash fixed here. I reviewed the full diff and ran the tests locally against Enterprise v1.55.
Summary by CodeRabbit