使用 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 參考