发布日期: 2026-07-27
版本号: v1.51.0

本次更新为 Meilisearch 带来了多项功能增强与优化。主要新增了动态搜索规则(DSR)的 filter 激活条件,允许基于特定分面值组合来启用规则,并引入了 lastUpdatedAt 字段以跟踪规则的最后更新时间,规则列表现默认按此时间降序排列。同时,为控制 DSR 引擎行为新增了四个相关环境变量。搜索请求速度显著提升,通过优化内部数据获取流程,在包含大量不同字段的数据集上实现了高达 5.4 倍的加速。此外,“无数据导出升级”功能已稳定,其启动参数重命名为 —-upgrade-db,并移除了若干已过时的实验性功能。修复了旧版属性模式(特别是过滤属性简写语法)的兼容性问题,并完善了多搜索日志,同步更新了相关文档与依赖组件。

更新内容 (中文)

✨ 增强功能

  • 为 DSR 添加过滤条件 由 @dureuill 在 https://github.com/meilisearch/meilisearch/pull/6505 中提出

    新的 filter 规则激活条件

    动态搜索规则现在可以声明一个新的 filter 条件:它包含一个 values 键,其值是一个 JSON 对象。 这个 values JSON 对象的键是分面名称(例如 colorgenres 等),而它们的值是过滤器必须为这些分面解析到的值,以便该规则被激活。

    发送带有 filter 条件的 DSR 的示例
    // PATCH /dynamic-search-rules/test-filter
    
    {
      "conditions": {
        "filter": {
          "values": {
            "color": "red",
            "category": "shirt"
          }
        }
      },
      "actions": [
        {
          "selector": { "id": "red shirt on sales" },
          "action": { "type": "pin", "position": 0 }
        }
      ]
    }
    
    启用上述 DSR 的搜索查询示例
    {
      "filter": "(category = shirt AND color = red) OR (category = jeans AND color = blue)"
    }
    

    请注意,过滤器只需要有一个分支解析到规则中声明的所有分面值,规则就会被激活。

    新的 lastUpdatedAt 字段

    通过 GET /dynamic-search-rules/{:ruleUid}POST /dynamic-search-rules 返回的动态搜索规则现在包含一个额外的 lastUpdatedAt 字段。 此字段会自动更新为最后修改该规则的任务的 enqueuedAt 值。

    规则按最近更新顺序列出

    POST /dynamic-search-rules 现在按 lastUpdatedAt 降序列出规则,这意味着最近更新的规则会首先列出。

    新的环境变量

    定义了新的环境变量来控制 DSR 引擎的行为:

    • MEILI_EXPERIMENTAL_DSR_FUEL_FILTER_FUEL(范围 0..4294967296):控制 Meilisearch 在搜索时尝试解析多少个过滤器约束组合后会放弃并应用部分规则。
    • MEILI_EXPERIMENTAL_DSR_FUEL_FILTER_OR_FUEL(范围 0..65536):控制 Meilisearch 在将过滤器转换为规范形式时构建多少个过滤器析取。
    • MEILI_EXPERIMENTAL_DSR_FUEL_FILTER_AND_FUEL(范围 0..65536):控制 Meilisearch 在将过滤器转换为规范形式时总共构建多少个过滤器合取。
    • MEILI_EXPERIMENTAL_DSR_FUEL_FILTER_DEPTH_FUEL(范围 0..256):控制 Meilisearch 在将过滤器转换为规范形式时允许的最大递归深度。
  • 加速搜索请求 由 @Kerollmops 在 https://github.com/meilisearch/meilisearch/pull/6528 中提出 通过避免不必要的内部工作来提高 Meilisearch 的搜索速度。我们将整个搜索管道中从磁盘检索数据的次数大幅减少到仅一次。此改进对文档中具有大量不同字段的数据集影响最大。我们在一个拥有超过 14k 个不同字段的数据集上,看到了高达 5.4 倍的搜索速度提升。

  • 稳定无转储升级 由 @curquiza 在 https://github.com/meilisearch/meilisearch/pull/6486 中提出 ⚠️ 随着实验性功能的稳定,这是一个破坏性变更 ⚠️ 标志 —-experimental-dumpless-upgrade 已重命名为 —-upgrade-db,行为完全相同。

  • 移除未使用的实验性功能 由 @curquiza 在 https://github.com/meilisearch/meilisearch/pull/6489 中提出 ⚠️ 破坏性变更:移除以下实验性功能 ⚠️

    • 复制参数:移除 --experimental-replication-parameters,因为它已过时。我们现在有其他处理复制的方法。
    • 使用旧文档索引器回退导入转储:移除 --experimental-no-edition-2024-for-dumps。此标志旨在防止与我们新索引器相关的错误,该索引器现已稳定。
    • 不压缩快照:移除 --experimental-no-snapshot-compaction,因为它已不再有用。

🪲 错误修复

🔩 杂项

新贡献者

更新内容 (原始)

✨ Enhancement

  • Add filter condition to DSRs by @dureuill in https://github.com/meilisearch/meilisearch/pull/6505

    New filter rule activation condition

    Dynamic search rules (DSR) can now declare a new filter condition: it contains a single values key, whose value is a JSON object. The keys of this values JSON object are the facet names (e.g., color, genres, …), while their values are the values that a filter must resolve to for these facets, so that the rule is active.

    Example of sending a DSR with a filter condition
    // PATCH /dynamic-search-rules/test-filter
    
    {
      "conditions": {
        "filter": {
          "values": {
            "color": "red",
            "category": "shirt"
          }
        }
      },
      "actions": [
        {
          "selector": { "id": "red shirt on sales" },
          "action": { "type": "pin", "position": 0 }
        }
      ]
    }
    
    Example of search query that enables the DSR above
    {
      "filter": "(category = shirt AND color = red) OR (category = jeans AND color = blue)"
    }
    

    Note that the filter only needs to have one branch resolving to all the facet values declared in the rule for the rule to be active.

    New lastUpdatedAt field

    Dynamic search rules returned by GET /dynamic-search-rules/{:ruleUid} and POST /dynamic-search-rules contain an additional lastUpdatedAt field.

    This field is automatically updated with the enqueuedAt value of the last task that modified the rule.

    Rules are listed with the most recently updated first

    POST /dynamic-search-rules now lists rules in descending lastUpdatedAt order, meaning that the most recently updated rules will be listed first.

    New environment variables

    New environment variables are defined to control the behavior of the DSR fuel:

    • MEILI_EXPERIMENTAL_DSR_FUEL_FILTER_FUEL (in range 0..4294967296): controls how many filter constraint combinations Meilisearch will attempt to resolve at search time before giving up and applying partial rules.
    • MEILI_EXPERIMENTAL_DSR_FUEL_FILTER_OR_FUEL (in range 0..65536): controls how many filter disjunctions Meilisearch will build when turning a filter to its canonical shape
    • MEILI_EXPERIMENTAL_DSR_FUEL_FILTER_AND_FUEL (in range 0..65536): controls how many filter conjunctions Meilisearch will build in total when turning a filter to its canonical shape
    • MEILI_EXPERIMENTAL_DSR_FUEL_FILTER_DEPTH_FUEL (in range 0..256): controls the maximum recursive depth that Meilisearch allows when turning a filter to its canonical shape
  • Speed up search requests by @Kerollmops in https://github.com/meilisearch/meilisearch/pull/6528 Improves Meilisearch search speed by avoiding unnecessary internal work. We drastically reduced the number of times we retrieve data from disk to a single time across the whole search pipeline. This improvement will have the greatest effect on datasets with a large number of distinct fields across documents. We have seen search speeds up to 5.4x on a dataset with more than 14k different fields.

  • Stabilize dumpless upgrade by @curquiza in https://github.com/meilisearch/meilisearch/pull/6486

    ⚠️ Breaking change following the stabilization of an experimental feature ⚠️

    The flag —-experimental-dumpless-upgrade is renamed —-upgrade-db, keeping the exact same behavior.

  • Remove unused experimental features by @curquiza in https://github.com/meilisearch/meilisearch/pull/6489

    ⚠️ Breaking change: removing the following experimental features ⚠️

🪲 Bug fixes

🔩 Miscellaneous

New Contributors

下载链接