Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scout/settings/update fails if an index doesn't have indexSettings #115

Open
timkelty opened this issue Nov 17, 2019 · 4 comments
Open

scout/settings/update fails if an index doesn't have indexSettings #115

timkelty opened this issue Nov 17, 2019 · 4 comments
Labels

Comments

@timkelty
Copy link
Collaborator

If you run scout/settings/update and every one of your indices doesn't call indexSettings, you'll get an error:

Exception 'TypeError' with message 'Argument 1 passed to rias\scout\engines\AlgoliaEngine::updateSettings() must be an instance of rias\scout\IndexSettings, null given, called in /app/vendor/composer/rias/craft-scout/src/console/controllers/scout/SettingsController.php on line 22'

in /app/vendor/composer/rias/craft-scout/src/engines/AlgoliaEngine.php:85

Stack trace:
#0 /app/vendor/composer/rias/craft-scout/src/console/controllers/scout/SettingsController.php(22): rias\scout\engines\AlgoliaEngine->updateSettings(NULL)
#1 /app/vendor/composer/tightenco/collect/src/Collect/Support/Collection.php(475): rias\scout\console\controllers\scout\SettingsController->rias\scout\console\controllers\scout\{closure}(Object(rias\scout\engines\AlgoliaEngine), 1)
#2 /app/vendor/composer/rias/craft-scout/src/console/controllers/scout/SettingsController.php(24): Tightenco\Collect\Support\Collection->each(Object(Closure))
#3 [internal function]: rias\scout\console\controllers\scout\SettingsController->actionUpdate('')
#4 /app/vendor/composer/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#5 /app/vendor/composer/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#6 /app/vendor/composer/yiisoft/yii2/console/Controller.php(164): yii\base\Controller->runAction('update', Array)
#7 /app/vendor/composer/craftcms/cms/src/console/Controller.php(199): yii\console\Controller->runAction('update', Array)
#8 /app/vendor/composer/yiisoft/yii2/base/Module.php(528): craft\console\Controller->runAction('update', Array)
#9 /app/vendor/composer/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('scout/settings/...', Array)
#10 /app/vendor/composer/craftcms/cms/src/console/Application.php(93): yii\console\Application->runAction('scout/settings/...', Array)
#11 /app/vendor/composer/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('scout/settings/...', Array)
#12 /app/vendor/composer/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#13 /app/bin/craft(7): yii\base\Application->run()
#14 {main}
@riasvdv
Copy link
Collaborator

riasvdv commented Nov 18, 2019

Seems like I forgot to add a test for this case ;) pretty straightforward fix to just filter the indices

@chadwells
Copy link

chadwells commented Oct 20, 2021

Hi there. Is there a workaround for this? Our use case is that we do not want to overwrite any settings that have been set within the Algolia admin site, so we wouldn't be specifying any index settings within our Scout config file.

@janhenckens
Copy link
Member

@chadwells Are you also running scout/settings/update ? That command is used to push settings from the scout config to Algolia so if don't want to do that I don't think you need this command.

@chadwells
Copy link

D'oh! Yep that completely makes sense. 😵 Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants