Skip to content

v1.57.0 🎯

Latest

Choose a tag to compare

@dureuill dureuill released this 16 Nov 09:22
· 31 commits to main since this release
1b78265

🌈 Improvements

View the target state of dynamic search rules

Note

Using this feature requires the Enterprise Edition. Enterprise Edition features are also available on Meilisearch Cloud.

Allows seeing the state of dynamic search rules (DSR) as if all pending DSR update tasks had been processed.

A "pending" task is a task that is either enqueued or currently processing.

Route to see the target state of a selected rule

The new GET /dynamic-search-rules/{:ruleUid}/target route returns the "target" state of the DSR, that is, an object with the following fields:

  • current, dynamic search rule object or null: the current values of the dynamic search rules, or null if the dynamic search rule doesn't exist yet
  • target, dynamic search rule object or null: the field of the dynamic search rules that will be modified by currently pending tasks, or null if the dynamic search rule will be deleted after all pending tasks have been processed
  • needsProcessing, boolean, true if at least one pending task pertaining to this dynamic search rule exists
  • taskUids, array of task uids, list of the pending tasks pertaining to the dynamic search rule

New body parameter to see the target state of all rules

The existing POST /dynamic-search-rules route used to list the dynamic search rules has a new showTarget parameter, an optional boolean. When present and true, showTarget modifies the response in the following way:

  1. new global fields in the response:
    • needsProcessing: boolean, true if at least one DSR update task exists
    • taskUids, array of task uids, list of the pending DSR update tasks
    • totalRuleCount, number, current total number of rules regardless of the filter. This field is different from total in that total indicates the total number of rules matching the optional filter passed in the body parameters of POST /dynamic-search-rules
    • targetTotalRuleCount, number, total number of rules that will exist after processing all pending DSR update tasks
  2. each rule returned in results has an additional needsProcessing boolean set to true if at least one pending DSR update task applies to this rule.

Examples

Creating a new rule and checking its target state

Creating a new rule
// PATCH /dynamic-search-rules/scale-rule
{
          "conditions": {
            "query": {
              "words": "HERO SUPER"
            }
          },
          "actions": {
            "scale": [
              {
                "ids": ["372631"],
                "weight": 2.0
              }
            ]
          }
}
Checking its target state before the task is processed
// GET /dynamic-search-rules/scale-rule/target

// response
{
        "current": null, // rule did not previously exist
        "needsProcessing": true, // rule needs processing
        "target": { // target state matches the update
          "actions": {
            "scale": [
              {
                "ids": ["372631"],
                "weight": 2.0
              }
            ]
          },
          "active": true,
          "conditions": {
            "query": {
              "words": "HERO SUPER"
            }
          }
        },
        "taskUids": [6] // id of the task that will create the rule
}
Listing the rules before the new rule has been created
// POST /dynamic-search-rules

// request body
{
  "showTarget": true
}

// response
{
        "results": [
          {
            "actions": {},
            "active": true,
            "conditions": {
              "time": {
                "end": "2032-12-31T09:50:12Z",
                "start": "2023-01-01T09:50:12Z"
              }
            },
            "lastUpdatedAt": "[lastUpdatedAt]",
            "needsProcessing": false, // existing rule doesn't need processing
            "uid": "skips-action-without-selector-id"
          },
          {
            "actions": {
              "pin": [
                {
                  "position": 0,
                  "id": "15242",
                  "indexUid": "movies"
                }
              ]
            },
            "active": true,
            "conditions": {
              "query": {
                "words": "super hero"
              }
            },
            "lastUpdatedAt": "[lastUpdatedAt]",
            "needsProcessing": false, // existing rule doesn't need processing
            "uid": "existing-rule-to-migrate"
          }
        ],
        "limit": 20,
        "offset": 0,
        "total": 2, // this might be lower depending on current filter
        "needsProcessing": true, // some task needs processing
        "totalRuleCount": 2, // always represents all existing rules
        "targetTotalRuleCount": 3, // one more because one rule is pending creation
        "taskUids": [6] // task that will create the rule
      }
Checking its target state after the task has been processed
// GET /dynamic-search-rules/scale-rule/target

// response
{
        "current": {
          "actions": {
            "scale": [
              {
                "ids": [
                  "372631"
                ],
                "weight": 2.0
              }
            ]
          },
          "active": true,
          "conditions": {
            "query": {
              "words": "HERO SUPER"
            }
          }
        },
        "target": {}, // no further change pending
        "taskUids": [],
        "needsProcessing": false
}
Listing the rules after the new rule has been created
// POST /dynamic-search-rules

// request body
{
  "showTarget": true
}

// response
{
        "limit": 20,
        "offset": 0,
        "results": [
          {
            "actions": {
              "pin": [
                {
                  "position": 0,
                  "id": "15242",
                  "indexUid": "movies"
                }
              ]
            },
            "active": true,
            "conditions": {
              "query": {
                "words": "super hero"
              }
            },
            "lastUpdatedAt": "[lastUpdatedAt]",
            "needsProcessing": false,
            "uid": "existing-rule-to-migrate"
          },
          {
            "actions": {
              "scale": [
                {
                  "ids": ["372631"],
                  "weight": 2.0
                }
              ]
            },
            "active": true,
            "conditions": {
              "query": {
                "words": "HERO SUPER"
              }
            },
            "lastUpdatedAt": "[lastUpdatedAt]",
            "needsProcessing": false,
            "uid": "scale-rule"
          },
          {
            "actions": {},
            "active": true,
            "conditions": {
              "time": {
                "end": "2032-12-31T09:50:12Z",
                "start": "2023-01-01T09:50:12Z"
              }
            },
            "lastUpdatedAt": "[lastUpdatedAt]",
            "needsProcessing": false,
            "uid": "skips-action-without-selector-id"
          }
        ],
        "total": 3,
        "totalRuleCount": 3,
        "targetTotalRuleCount": 3, // agrees with totalRuleCount
        "needsProcessing": false, // target state has been reached
        "taskUids": [] // always empty when no processing needed
      }

Updating an existing rule

Updating the conditions of an existing rule
// PATCH /dynamic-search-rules/existing-rule-to-migrate

// request body
{
  "conditions": {
    "query": {
      "words": "SUPER hero"
    }
  }
}
Checking the target state of the rule before the task has been processed
// GET /dynamic-search-rules/existing-rule-to-migrate/target

// response
{
        "current": { // rule already exists
          "actions": {
            "pin": [
              {
                "id": "15242",
                "indexUid": "movies",
                "position": 0
              }
            ]
          },
          "active": true,
          "conditions": {
            "query": {
              "words": "super hero"
            }
          }
        },
        "needsProcessing": true,
        "target": {
          "conditions": {
            "query": {
              "words": "SUPER hero" // only modified values appear in target
            }
          }
        },
        "taskUids": [7] // id of the task that will update the rule
      }
Listing the rules before the rule has been updated
// POST /dynamic-search-rules

// request body
{
  "showTarget": true
}

// response
{
        "results": [
          {
            "actions": {
              "pin": [
                {
                  "position": 0,
                  "id": "15242",
                  "indexUid": "movies"
                }
              ]
            },
            "active": true,
            "conditions": {
              "query": {
                "words": "super hero" // still indicates the current value, check the details GET target route to get the details
              }
            },
            "lastUpdatedAt": "[lastUpdatedAt]",
            "needsProcessing": true, // this task will be updated
            "uid": "existing-rule-to-migrate"
          },
          {
            "actions": {
              "scale": [
                {
                  "ids": ["372631"],
                  "weight": 2.0
                }
              ]
            },
            "active": true,
            "conditions": {
              "query": {
                "words": "HERO SUPER"
              }
            },
            "lastUpdatedAt": "[lastUpdatedAt]",
            "needsProcessing": false,
            "uid": "scale-rule"
          },
          {
            "actions": {},
            "active": true,
            "conditions": {
              "time": {
                "end": "2032-12-31T09:50:12Z",
                "start": "2023-01-01T09:50:12Z"
              }
            },
            "lastUpdatedAt": "[lastUpdatedAt]",
            "needsProcessing": false,
            "uid": "skips-action-without-selector-id"
          }
        ],
        "limit": 20,
        "offset": 0,
        "total": 3,
        "totalRuleCount": 3,
        "targetTotalRuleCount": 3, // agrees with totalRuleCount
        "needsProcessing": true, // at least one rule will be updated
        "taskUids": [7] // id of the task that will update any DSR
      }
Checking its target state after the task has been processed
// GET /dynamic-search-rules/existing-rule-to-migrate/target

// response
{
        "current": {
          "actions": {
            "scale": [
              {
                "ids": [
                  "372631"
                ],
                "weight": 2.0
              }
            ]
          },
          "active": true,
          "conditions": {
            "query": {
              "words": "HERO SUPER"
            }
          }
        },
        "target": {}, // no change
        "taskUids": [], // no task remaining to update the rule
        "needsProcessing": false // no processing remaining for this rule
      }
Listing the rules after the rule has been updated
// POST /dynamic-search-rules

// request body
{
  "showTarget": true
}

// response
{
        "results": [
          {
            "actions": {
              "pin": [
                {
                  "position": 0,
                  "id": "15242",
                  "indexUid": "movies"
                }
              ]
            },
            "active": true,
            "conditions": {
              "query": {
                "words": "SUPER hero" // indicates the modified value
              }
            },
            "lastUpdatedAt": "[lastUpdatedAt]",
            "needsProcessing": false, // already updated
            "uid": "existing-rule-to-migrate"
          },
          {
            "actions": {
              "scale": [
                {
                  "ids": ["372631"],
                  "weight": 2.0
                }
              ]
            },
            "active": true,
            "conditions": {
              "query": {
                "words": "HERO SUPER"
              }
            },
            "lastUpdatedAt": "[lastUpdatedAt]",
            "needsProcessing": false,
            "uid": "scale-rule"
          },
          {
            "actions": {},
            "active": true,
            "conditions": {
              "time": {
                "end": "2032-12-31T09:50:12Z",
                "start": "2023-01-01T09:50:12Z"
              }
            },
            "lastUpdatedAt": "[lastUpdatedAt]",
            "needsProcessing": false,
            "uid": "skips-action-without-selector-id"
          }
        ],
        "limit": 20,
        "offset": 0,
        "total": 3,
        "totalRuleCount": 3,
        "targetTotalRuleCount": 3, // agrees with totalRuleCount
        "needsProcessing": false, // no pending update
        "taskUids": [] // empty list of tasks
      }

By @dureuill in #6715

🦋 Fixes

Fix relevancy issue in federated search

Fixes a v1.54 regression in federated search where interleaving relevancy and sort rules would skip every other rule. For instance, a sort ranking rule could be skipped if placed after a relevancy rule.

By @dureuill in #6731

Fix Apple Silicon binary generation

Upgrade macos runner following removal by GH

By @dureuill in #6734

🔩 Miscellaneous

  • Fix version comment of the pinned Homebrew bump action by @curquiza in #6718

Full Changelog: v1.56.2...v1.57.0