Skip to content

[Meilisearch v1.55] Add support for dynamic search rule preview #996

Open

Description

@Strift

Context

Meilisearch v1.55.0 introduces dynamic search rule preview.

Objective

Update the SDK to support previewing a dynamic search rule by sending an inline rule on search and multi-search. This requires Meilisearch Enterprise Edition and the dynamicSearchRules experimental feature.

POST /indexes/{indexUid}/search:

{
  "q": "super hero",
  "inlineRule": {
    "uid": "user-likes-batman",
    "actions": {
      "scale": [
        {
          "filter": "hero = batman AND release_time = fresh",
          "weight": 1.2
        }
      ]
    }
  }
}

POST /multi-search with Meili-Include-Metadata: true header:

{
  "queries": [
    {
      "indexUid": "products",
      "q": "fashion",
      "filter": "color = blue AND category = shirt"
    },
    {
      "indexUid": "products",
      "q": "fashion",
      "filter": "color = blue AND category = shirt",
      "inlineRule": {
        "uid": "special-sales",
        "conditions": {
          "query": {
            "words": "pants"
          },
          "filter": {
            "values": {
              "color": "yellow",
              "stock_intent": "destock"
            }
          }
        }
      }
    }
  ]
}

The query that sends inlineRule returns metadata.inlineRuleConditionOutcomes. In this example the rule does not apply, so the hits stay the same and the outcomes explain why:

{
  "results": [
    {
      "hits": []
    },
    {
      "hits": [],
      "metadata": {
        "queryUid": "0199a41a-8186-70b3-b6e1-90e8cb582f35",
        "indexUid": "products",
        "inlineRuleConditionOutcomes": {
          "satisfiesActiveCondition": true,
          "satisfiesQueryWordsCondition": {
            "missingWord": {
              "word": "pants"
            }
          },
          "satisfiesFilterCondition": {
            "missingConstraintOnField": {
              "field": "stock_intent"
            }
          }
        }
      }
    }
  ]
}

Tasks

  • Accept inlineRule on search and multi-search requests
    • Return metadata.inlineRuleConditionOutcomes when the Meili-Include-Metadata header is true
  • Add test cases for the new parameter
    • Search with inlineRule
    • Multi-search with inlineRule
    • Condition outcomes in metadata

Activity

  1. Monika218126 commented on Oct 13, 2026

    @Monika218126

    Hi! I've completed the initial implementation of dynamic search rule preview support in the Java SDK.

    The changes include:

    • Added inlineRule support to search and multi-search requests.
    • Added response metadata support for inline rule condition outcomes.
    • Added unit tests for request serialization and Gson/Jackson response deserialization.
    • Added integration test coverage for the new functionality.

    All focused unit tests are passing, and the implementation has been committed locally. The Enterprise-specific integration behavior still requires verification against a Meilisearch Enterprise server.

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions