weixin_39706367
weixin_39706367
2021-01-08 02:53

[core] Scout indexes not updating on model update

I have Scout connected to Algolia, and when I update a model, the Algolia index isn't updated for the model:

screen shot 2017-07-27 at 1 46 29 pm

After saving that change, this is my Algolia index value:

screen shot 2017-07-27 at 1 49 03 pm

Scout is configured correctly - I can run artisan scout:import and the models update correctly.

该提问来源于开源项目:pyrocms/pyrocms

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

6条回答

  • weixin_39951378 weixin_39951378 4月前

    Is your stream marked as searchable?

    点赞 评论 复制链接分享
  • weixin_39706367 weixin_39706367 4月前

    I assumed that the fact that they all use Searchable, that they would be. Is there a searchable attribute that needs to be flagged on the stream?

    点赞 评论 复制链接分享
  • weixin_39951378 weixin_39951378 4月前

    so the base EntryModel uses that trait inherently - so just do this on your entry model (or flag the stream definition):

    protected $searchable = true;

    点赞 评论 复制链接分享
  • weixin_39951378 weixin_39951378 4月前

    That should resolve your issue - open er back up if not ^_^

    点赞 评论 复制链接分享
  • weixin_39938331 weixin_39938331 4月前

    I have connected Elasticsearch with Scout but indexes for my models are not updated. As said artisan scout:import {model} works fine for me as well but when I update the model index in Elasticsearch is not updated. Moreover core Pyro models (like Post, Page, User) work great - index in ES is updated. My models have flag searchable set to true. I am not sure what I am doing wrong.

    Pyro 3.6 Elasticsearch 5.6.15 Package for scout: tamayo/laravel-scout-elastic:~3

    • did you solve your problem?

    EDIT: I was doing some unit tests and when I do something like this:

    php
    $model = factory(MyModel::class)->make();
    
    $model->save();
    

    index is updated.

    But on saving the form (via browser) it does not work.

    点赞 评论 复制链接分享
  • weixin_39951378 weixin_39951378 4月前

    Are you leveraging observers at all? Make sure that observers continue the call to the parent:: so that deeper parts of automation in streams can work.

    点赞 评论 复制链接分享

相关推荐