Copied to clipboard

Flag this post as spam?

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


  • Sean Dooley 288 posts 527 karma points
    Dec 18, 2017 @ 12:19
    Sean Dooley
    0

    Periodically add new items to a custom data set Examine Index

    Following the information in this great article, https://24days.in/umbraco-cms/2016/custom-data-and-examine-searching/, I've managed to setup a custom data set for an Examine Index.

    I'm now looking at how to periodically add new items to the index without having to do a full index re-build. Is there any documentation available for this?

  • Markus Johansson 1911 posts 5735 karma points MVP c-trib
    Dec 18, 2017 @ 15:23
    Markus Johansson
    100

    Hi!

    I did have examples for this but I could not find it right now. But basiclly theres methods on the IndexProviderCollection to reindex and delete items.

    I'm not 100% sure but it might be that you just use "ReIndexNode()" to add a new item... I'm sorry but I can remember on top of my head....

    Hope this helps a little bit:

    private void UpdateIndex(MyObject myObject) {
    var examineNode = myObject
                .ToSimpleDataSet() // you need to implement this
                .RowData
                .ToExamineXml(myObject.Id, "myObject");
       ExamineManager
        .Instance
        .IndexProviderCollection["MyIndexer"]
        .ReIndexNode(examineNode, "myObject");
     }
    

    And to delete a row

       private void DeleteTownFromIndex(MyObject myObject) {
         ExamineManager
        .Instance
        .IndexProviderCollection["MyIndexer"]
        .DeleteFromIndex(myObject.Id.ToString(CultureInfo.InvariantCulture));
      }
    
  • Sean Dooley 288 posts 527 karma points
    Dec 20, 2017 @ 08:19
    Sean Dooley
    0

    Thank you Markus.

Please Sign in or register to post replies

Write your reply to:

Draft