Copied to clipboard

Flag this post as spam?

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


  • Jasper van der Sterren 13 posts 33 karma points
    Oct 22, 2012 @ 14:47
    Jasper van der Sterren
    0

    Examine RebuildIndex not indexing unpublished nodes

    I'm using an Examine index to index both published and unpublished nodes. I'm using Umbraco 4.9.0 on Windows 2008R2, IIS 7.

    ExamineIndex.config (partial):

     

    <IndexSet SetName="B2CIndexSet" IndexPath="~/App_Data/ExamineIndexes/B2CIndex/" IndexParentId="-1">
        <IndexAttributeFields />
        <IndexUserFields/>
        <IncludeNodeTypes>
            <add Name="Project" />
            <add Name="Property" />
        </IncludeNodeTypes>
        <ExcludeNodeTypes />
    </IndexSet>
    
    ExamineSettings.config (partial):

     

    <add name="B2CIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
      runAsync="false"
      supportUnpublished="true"
      supportProtected="true"
      interval="10"
      indexSet="B2CIndexSet"
      analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>
    
    <add name="B2CSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
    analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
    indexSet="B2CIndexSet"/>

     

    The runAsync="false" is for debugging purposes. When saving/publishing documents this works fine and both published and unpublished documents are saved into the index. However when rebuilding the index, ie. with the following code:

    var indexProvider = ExamineManager.Instance.IndexProviderCollection["B2CIndexer"];
    indexProvider.RebuildIndex();
    
    Examine only re-indexes published nodes, and not the unpublished ones, even though supportUnpublished="true". I need to rebuild the index quite regularly, and there are a lot of nodes in the project so manually saving them is not possible.
    Any idea how I can get the index rebuild to also index unpublished nodes?
    Thanks,
    Jasper.

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Nov 01, 2012 @ 18:03
    Tom Fulton
    0

    Seeing the same issue here - unpublished nodes don't get added to the index until they are saved.  So if the index ever gets rebuilt, they don't include the unpublished nodes.

    Did you ever get anywhere on this?

  • Mads Krohn 211 posts 504 karma points c-trib
    Nov 01, 2012 @ 18:13
    Mads Krohn
    1

    This is related, though still not fixed unfortunately :(

  • Jasper van der Sterren 13 posts 33 karma points
    Nov 01, 2012 @ 19:45
    Jasper van der Sterren
    0

    I just created a custom reindexing method:

    var indexProvider = ExamineManager.Instance.IndexProviderCollection["B2CIndexer"];
    var documentType = DocumentType.GetByAlias("DocumentTypeToIndex");
    foreach (var doc in Document.GetDocumentsOfDocumentType(documentType.Id).Where(doc => doc.Creator != null && !doc.IsTrashed))
    {
    indexProvider.ReIndexNode(doc.ToXDocument(false).Root, IndexTypes.Content);
    }

    In my case I needed it for a specific document type, but basically you just get all the documents that you want to reindex and go through them in a loop. It's quite slow though.

Please Sign in or register to post replies

Write your reply to:

Draft