Algolia + Laravel -- 不要在特定的 save() 实例更新索引
Algolia + Laravel -- Do not update index at a specific instance of save()
我正在使用 Laravel Scout + Algolia。我们已经达到了我们的使用限制,因为每次有人访问我们网站上的内容页面时,我都会更新数据库中的条目以增加页面浏览量计数器。然后这会触发 Algolia 更新,即使 page_views
变量甚至没有存储在 Algolia 中。我想知道是否有一种方法可以在不触发 Algolia 更新的情况下更新数据库条目。
在文档中有一段关于 here。
基本上你可以 运行 闭包而不用这种方式同步到 Algolia:
$currentInstance = 'your-model'; // This is the variable you want to inject
App\YourModel::withoutSyncingToSearch(function () use ($currentInstance) {
// Do the increment, and algolia indexing will not be updated
});
我正在使用 Laravel Scout + Algolia。我们已经达到了我们的使用限制,因为每次有人访问我们网站上的内容页面时,我都会更新数据库中的条目以增加页面浏览量计数器。然后这会触发 Algolia 更新,即使 page_views
变量甚至没有存储在 Algolia 中。我想知道是否有一种方法可以在不触发 Algolia 更新的情况下更新数据库条目。
在文档中有一段关于 here。
基本上你可以 运行 闭包而不用这种方式同步到 Algolia:
$currentInstance = 'your-model'; // This is the variable you want to inject
App\YourModel::withoutSyncingToSearch(function () use ($currentInstance) {
// Do the increment, and algolia indexing will not be updated
});