在 Algolia 索引设置中找到“Attributes for faceting”(聚合属性)选项卡,重新添加搜索属性并删除旧属性。具体代码示例如下:
algolia_index.set_settings({ 'searchableAttributes': [ 'newAttribute1', 'newAttribute2', 'newAttribute3', ], 'customRanking': [ 'desc(popularity)', ], 'attributesForFaceting': [ 'newAttribute1', 'newAttribute2', 'newAttribute3', ], });
注意,在大多数情况下,“indexName不合法”错误是由于 Algolia 索引设置中添加、删除、更改搜索属性和聚合属性导致的。因此,将它们重新添加和更新可能会解决此问题。