Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Steve Andrews 4 posts 34 karma points
    Jan 20, 2021 @ 15:45
    Steve Andrews
    0

    Custom Index on Azure not updating replica

    Hi

    I've created load-balanced Azure Web App setup - 1 master admin and 1 (for now) replica front-end as per the docs.

    It seems to work fine - when I update a node in the admin then the index on the replica also appears to get updated.

    However I have also created a custom index but when I manually add something to the index on the admin instance then the change doesn't propagate to the replica e.g.

    IIndex catalogIndex;
    ExamineManager.Instance.TryGetIndex("Catalog", out catalogIndex);
    catalogIndex.IndexItem(valueSet);
    

    At this point the admin instance index has this new value but the replica doesn't and never seems to get it.

    Do I need to call something to notify the replica to update? Obviously the normal publish is doing something more complex than IndexItem() with the InternalIndex. Is this something to do with EnableDefaultEventHandler perhaps? I can't see how to set this in Umbraco 8 for a custom index.

    Thanks.

    Steve

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    Jan 20, 2021 @ 18:25
    Søren Gregersen
    100

    Hi,

    You need something to tell the other servers to also index the item. This can be done with a CacheRefresher.

    There are examples in the ExamineComponent on how the refresh events can be handled to reindex an item: https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/src/Umbraco.Web/Search/ExamineComponent.cs

    HTH :)

  • Steve Andrews 4 posts 34 karma points
    Jan 21, 2021 @ 12:52
    Steve Andrews
    0

    Thanks for linking to this,

    ContentCacheRefresher.CacheUpdated += ContentCacheRefresher_CacheUpdated;
    

    was exactly what I needed.

  • Dhanesh Kumar MJ 165 posts 521 karma points MVP c-trib
    Aug 25, 2021 @ 12:18
    Dhanesh Kumar MJ
    0

    Hi ,

    I am stuck on this part, how did you solve the issue?

  • Steve Andrews 4 posts 34 karma points
    Aug 25, 2021 @ 13:50
    Steve Andrews
    0

    In a composition add an event handler for:

    ContentCacheRefresher.CacheUpdated

    In your handler populate/remove the custom index items as required (as opposed for using ContentService_Published for example).

    This works across master/slave instances of Umbraco.

  • Dhanesh Kumar MJ 165 posts 521 karma points MVP c-trib
    Aug 25, 2021 @ 17:09
    Dhanesh Kumar MJ
    0

    Hi Steve,

    Yes, I did, and it's working now. I forget to update the thread, anyway thanks for the reply, much appreciated ;)

Please Sign in or register to post replies

Write your reply to:

Draft