本教程将向您展示如何使用 Meilisearch Cloud 界面检查和更改索引设置。

要求

  • 一个活跃的 Meilisearch Cloud 帐户
  • 一个至少包含一个索引的 Meilisearch Cloud 项目

访问项目的索引设置

登录您的 Meilisearch 帐户并导航到您的项目。然后,点击“索引”
The main menu of the project view in the Meilisearch Cloud interface. Menu items include 'Indexes' among other options such as 'Settings' and 'Analytics'.
找到您要配置的索引并点击其“设置”按钮
A list of indexes in a Meilisearch Cloud project. It shows an index named 'books' along with a few icons and buttons. One of these buttons is 'Settings.'

检查设置的当前值

使用左侧菜单,点击“属性”
The index configuration overview together with a menu with links to pages dedicated to various index settings.
第一个设置是“可搜索属性”,并列出了数据集中所有文档中的属性
The 'Searchable attributes' configuration section showing six attributes. One of them, 'id' is this index's primary key.
点击其他设置将显示类似的界面,允许可视化和编辑所有 Meilisearch 索引设置。

更新设置

所有文档都包含一个主键属性。在大多数情况下,此属性不包含与搜索相关的信息,因此您可以通过将其从可搜索属性列表中明确删除来改进应用程序的搜索。 找到您的主键,然后点击垃圾桶图标:
The same 'Searchable attributes' list as before, with the bin-shaped 'delete' icon highlighted.
Meilisearch 将显示一个弹出窗口,询问您是否确认要从可搜索属性列表中删除该属性。点击“是,删除属性”
A pop-up window over the index settings interface. It reads: 'Are you sure you want to remove the attribute id?' Below it are two buttons: 'Cancel' and 'Yes, remove attribute'.
对索引设置的大多数更新将导致 Meilisearch 重新索引其所有数据。请稍等片刻,直到此操作完成。在此期间不允许更新任何索引设置。 一旦 Meilisearch 完成索引,主键将不再出现在可搜索属性列表中:
The same 'Searchable attributes' list as before. It only contains five searchable attributes after removing the primary key.
如果您删除了错误的属性,点击“添加属性”将其添加回列表。您还可以点击“重置为默认”,这将把可搜索列表恢复到您首次将第一个文档添加到此索引时的原始状态
The same 'Searchable attributes' list as before. Two buttons on its top-right corner are highlighted: 'Reset to default' and 'Add attributes'.

结论

您已使用 Meilisearch Cloud 界面检查索引设置的值。这揭示了改进项目性能的机会,因此您更新了此索引设置,使您的应用程序更好、响应更快。 本教程使用了“可搜索属性”设置,但无论您编辑哪个索引设置,过程都是相同的。

接下来

如果您更喜欢通过控制台直接访问设置 API,您还可以使用 Meilisearch Cloud API 配置索引设置 有关所有索引设置的全面参考,请查阅设置 API 参考
© . This site is unofficial and not affiliated with Meilisearch.