Copied to clipboard

Flag this post as spam?

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


  • Adriano Fabri 469 posts 1633 karma points
    Aug 30, 2021 @ 10:59
    Adriano Fabri
    0

    How to rebuild index from a custom SurfaceController (Umbraco 8.14)

    Hi to all, I'm trying to rebuild a custom index from a custom SurfaceController.

    I saw and tried many guides found on our.umbraco and on internet but unfortunately none of them worked.

    Can someone help me?

    Thank you A.

  • Lucas Michaelsen 32 posts 233 karma points
    Sep 16, 2021 @ 13:06
    Lucas Michaelsen
    100

    Hello Adriano

    How you try this.

    public class TestController : SurefaceController {
        private readonly IndexRebuilder _indexRebuilder;
    
        public TestController(IndexRebuilder indexRebuilder) {
             _indexRebuilder = indexRebuilder;
        }
    
        public ActionResult Index() {
             _indexRebuilder.RebuildIndex(indexName);
        }
    }
    

    i know the Umbraco Code, the are using the IndexRebuilder class when you hit the rebuild index button in examin dashboard. Hope it will work!

  • Adriano Fabri 469 posts 1633 karma points
    Sep 17, 2021 @ 12:20
    Adriano Fabri
    0

    Thank you very much Lucas

    This works like a charm

    Adriano

Please Sign in or register to post replies

Write your reply to:

Draft