Copied to clipboard

Flag this post as spam?

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


  • Raimond 6 posts 116 karma points
    Oct 24, 2016 @ 19:25
    Raimond
    0

    Examine SearchProvider keeps holding deleted items (v7.5.3)

    For a list implementation of event items I thought it handy to use the Examine ExternalIndexSet and an ExternalSearcher in order to speedily fetch lists of events. the index configuration looks like:

    <ExamineIndexProviders>
     <!-- default external indexer, which excludes protected and unpublished pages-->
        <add name="ExternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
            enableDefaultEventHandler="true"
            supportUnpublished="false"
            supportProtected="false"
        />
    
    </providers>
     </ExamineIndexProviders>
     <ExamineSearchProviders defaultProvider="ExternalSearcher">
     <providers>
       <add name="ExternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" 
       indexSet="ExternalIndexSet" />
    </ExamineSearchProviders>
    

    This is working perfectly, but with one big issue: whenever a node is unpublished, the Searcher keeps giving it back until the web app is restarted!

    After some investigation, I see that the node which is unpublished, is actually trying to get processed in the Examine index:

    INFO  Umbraco.Core.Publishing.PublishingStrategy - Content 'blabla' with Id '14384' has been unpublished.
    DEBUG Umbraco.Core.Sync.ServerMessengerBase - Invoking refresher Umbraco.Web.Cache.PageCacheRefresher on local server for message type RemoveByInstance
    DEBUG Umbraco.Web.PublishedCache.XmlPublishedCache.XmlCacheFilePersister - Touched, was released...
    DEBUG Umbraco.Web.PublishedCache.XmlPublishedCache.XmlCacheFilePersister - Create new...
    DEBUG Umbraco.Web.Scheduling.BackgroundTaskRunner - [XmlCacheFilePersister] Task added Umbraco.Web.PublishedCache.XmlPublishedCache.XmlCacheFilePersister
    DEBUG Umbraco.Web.PublishedCache.XmlPublishedCache.XmlCacheFilePersister - Created, save in 4000ms.
    DEBUG UmbracoExamine.DataServices.UmbracoLogService - DeleteFromIndex with query: __Path:\-1\,*14384\,* (found 0 results), Provider=ExternalIndexer, NodeId=14384
    DEBUG UmbracoExamine.DataServices.UmbracoLogService - Index deleted for term: __NodeId with value 14384, Provider=ExternalIndexer, NodeId=-1
    DEBUG UmbracoExamine.DataServices.UmbracoLogService - ReIndexNode with type: content, Provider=InternalIndexer, NodeId=14384
    DEBUG UmbracoExamine.DataServices.UmbracoLogService - AddSingleNodeToIndex with type: content, Provider=InternalIndexer, NodeId=14384
    DEBUG UmbracoExamine.DataServices.UmbracoLogService - Index created for node 14384, Provider=InternalIndexer, NodeId=14384
    DEBUG Umbraco.Web.PublishedCache.XmlPublishedCache.XmlCacheFilePersister - Timer: release.
    DEBUG Umbraco.Web.PublishedCache.XmlPublishedCache.XmlCacheFilePersister - Run now (sync).
    umbraco.content - Save Xml to file...
    umbraco.content - Saved Xml to file.
    Umbraco.Web.Scheduling.ScheduledTasks - Scheduled tasks executing
    DEBUG Umbraco.Web.Scheduling.KeepAlive - Keep alive executing
    DEBUG Umbraco.Web.Scheduling.ScheduledTasks - Scheduled tasks complete (took 0ms)
    

    As you can see, a delete is triggered, so that appears fine. What I do see in the backend is that when I go to the Examine Management section and to the specific index, I see that Has Deletions? is set to true and then the number of deleted nodes are next to it.

    These deletions are then set to 0 when I click Optimize Index. However - even after optimizing, the node is still present in the search results until I restart the web app or rebuild the index!

    Then I checked my code and I do something very simple:

    var externalSearcher =
            ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"];
    
            var criteria = externalSearcher.CreateSearchCriteria();
    
    
            var query = olderOrNewer.Equals("older")
                ? criteria.NodeTypeAlias("agendaItem").And().Range("eventSortDate", DateTime.MinValue, fromDateTime)
                    .And()
                    .OrderByDescending("eventSortDate")
                : criteria.NodeTypeAlias("agendaItem").And().Range("eventSortDate", fromDateTime, DateTime.MaxValue).And().OrderBy("eventSortDate");
    
            var searchResults = externalSearcher.Search(query.Compile(), maxItems);
    

    As far as I know, I'm not holding any reference to a search collection.

    Can anyone tell me what I'm doing wrong?

  • Raimond 6 posts 116 karma points
    Oct 24, 2016 @ 20:50
    Raimond
    100

    After some digging I found the answer. Apparently there was a bug in Examine 0.1.69 and upgrading to Umbraco 7.5.4 and Examine 0.1.70 did the trick.

    More info:

    http://issues.umbraco.org/issue/U4-9050

    and especially in this beautiful thread: https://github.com/Shazwazza/Examine/issues/55

Please Sign in or register to post replies

Write your reply to:

Draft