Copied to clipboard

Flag this post as spam?

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


  • Robert J. Bullock 386 posts 405 karma points
    Jan 15, 2016 @ 17:43
    Robert J. Bullock
    0

    Does Saving Media from Media Service trigger publishing event?

    I am updating a bunch of media items in code using the Media Service. However, when I query the media as IPublishedContent, it appears that the new values are not coming back.

    My question is, does the MediaService.Save method update the umbraco.config XML cache? It doesn't appear so.

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Jan 16, 2016 @ 11:05
    Marc Goodson
    0

    Hi Robert

    No, Media Information is not stored in the XML Cache file, instead when you are pulling back Media using the UmbracoHelpers and IPublishedContent, the information comes from the Examine Indexes, and falls back to the database.

    There could be a lag in time between the MediaService.Save and the update reaching the examine index, however if the updated information never appears - try rebuilding your internal examine index via the back office developers section, to repopulate with the updated values.

    If this doesn't magically display the updated values, then possibly there is a corrupt rogue item that is preventing your indexes from being rebuilt; also in some versions 6.1/6.2 issues were reported with the indexes becoming corrupt. (not sure which vesion you are using)

    regards

    Marc

  • Robert J. Bullock 386 posts 405 karma points
    Jan 16, 2016 @ 19:28
    Robert J. Bullock
    0

    The updated data does appear but the time lag is a problem. I never knew that media queries hit the Examine index vs. the XML cache. That is odd. So is the solution to manually (in code) trigger an Examine re-index?

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Jan 19, 2016 @ 18:45
    Marc Goodson
    0

    Hi Robert,

    The act of saving the media item should trigger Examine to re-index, but it's just not guaranteed to be instant.

    When the media item doesn't exist in the Examine index it falls back to the database; but in your situation it does exist! so you get the non updated data!

    I guess the answer to 'what to do' depends alot on what are you trying to achieve, and in what context? ie at the point of update of the media item; when is that updated data next accessed, how long is it taking for the indexing to refresh ? is it a one off batch update, and afterwards you just want to flush the cache (/umbraco/dialogs/republish.aspx?xml=true)

    The size of the InternalIndexSet may be increasing the reindex lag time; particularly if your site has alot of content (and versions have built up over time - see UnVersion package)

Please Sign in or register to post replies

Write your reply to:

Draft