Copied to clipboard

Flag this post as spam?

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


  • Jan Bengtsson 64 posts 107 karma points
    Aug 12, 2020 @ 08:23
    Jan Bengtsson
    0

    Rebuild Index issue

    Hi,

    Using Umbraco Examine for my latest Umbraco 8 site has given me a problem I don't seem to be able to solve on my own. The requirements for the site include that a number of custom database tables should be searchable. I have implemented this in accordance with the instructions on this page:

    https://skrift.io/issues/examine-in-umbraco-8/

    ... and it works fine. But I also have to rebuild the custom index programmatically at certain times, and it needs to happen in a new thread or using Async/Await. Unfortunately, the objects in IndexPopulator are in those cases set to null (in the PopulateIndexes method).

    So:

    _indexRebuilder.RebuildIndex([indexname])
    

    ...works under normal circumstances, but in a new thread or with Async/Await an "Object reference not set ..." error is raised.

    Anyone who knows how to handle this problem?

    /Jan

  • David Armitage 508 posts 2078 karma points
    Aug 13, 2020 @ 05:04
    David Armitage
    0

    Hi,

    I think I remember Umbraco 7 used to have a public url that rebuilds the index. I wonder if Umbraco 8 still has this.

    Maybe you could do an async web request to this url and have more luck.

    If not then maybe you could create an APIController that handles the rebuild then do the same. Call this in a web request.

    Regards

    David

  • Jan Bengtsson 64 posts 107 karma points
    Aug 13, 2020 @ 09:31
    Jan Bengtsson
    0

    Thanks for trying to help, David. I have done some googling and testing based on your suggestions, but no one is going anywhere. I still get the NullReferenceException in the IndexPopulator.

    Note again that I have no problem rebuilding my custom index programmatically the Umbraco 8 way - in the main thread. The error occurs when trying to do it from within a new thread or asynchronously. Which I have to.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft