Copied to clipboard

Flag this post as spam?

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


  • David McDonnell 53 posts 251 karma points
    Jan 09, 2017 @ 16:05
    David McDonnell
    0

    Examine Index Issue on Umbraco 7.5.4

    I was wondering if anyone else had the following issues with the Umbraco 7.5.4 and Examine 0.1.70

    When publishing items / deleting them the examine management screen is telling me that I have deletions to be applied to my indexes and that the indexes are no longer optimized.

    When looking at the Provider Properties: autoOptimize is set to false this is supposed to default to True if not set, I have tried setting this to true manually but it still outputs false. see below: In the image below I have manually rebuilt and optimized the indexes from the management screen buttons

    enter image description here

    Also I have built a test class to hook into the ContentService Published and Deleted Events so I can Rebuild and Optimize the indexes on these events triggering.

    It appears that the Index is rebuilt but not optimized. Code Snipped below:

    public class ContentPublishedService : ApplicationEventHandler
    {
        private const string ExternalIndexName = "ExternalIndexer";
        private const string InternalIndexName = "InternalIndexer";
        private const string OptimizeURL = "/umbraco/BackOffice/Api/ExamineManagementApi/PostOptimizeIndex";
        private string UrlParameters = "indexerName={0}";
    
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication,
            ApplicationContext applicationContext)
        {
            Umbraco.Core.Services.ContentService.Deleted += ContentService_Deleted;
            Umbraco.Core.Services.ContentService.Published += ContentService_Published;
        }
    
        public void ContentService_Published(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs<Umbraco.Core.Models.IContent> e)
        {
            RebuildAndOptimizeIndex(ExternalIndexName);
        }
    
        public void ContentService_Deleted(Umbraco.Core.Services.IContentService sender, Umbraco.Core.Events.DeleteEventArgs<Umbraco.Core.Models.IContent> e)
        {
            RebuildAndOptimizeIndex(ExternalIndexName);
        }
    
        private void RebuildAndOptimizeIndex(string indexName)
        {
            LuceneIndexer indexer = ExamineManager.Instance.IndexProviderCollection[indexName] as LuceneIndexer;
            if (indexer != null)
            {
                indexer.RebuildIndex();
                indexer.OptimizeIndex();
            }
        }
    }
    

    From Git it looks as if autoOptimize has been depreciated.

    If anyone can tell me should Examine but auto updating these indexes always on publish / unpublish / delete

    Any help would be appreciated

    Cheers David

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Jan 09, 2017 @ 16:09
    Damiaan
    0

    I would strongly advise against reindexing AND optimizing after content deletes and published. There is no good reason to do that imho.

    Rebuilding takes time and will cripple your site during the process. Optimizing the index too frequently is not good too for various lucene related reasons (as I understood).

    Why would you consider a solution like this?

  • David McDonnell 53 posts 251 karma points
    Jan 09, 2017 @ 16:57
    David McDonnell
    0

    Hi Damiaan, thanks for your reply, this is just a test POC to see if the optimization would work from code, which it isnt.

    Have you any insights on the issue I am experiencing

  • David McDonnell 53 posts 251 karma points
    Jan 23, 2017 @ 11:08
    David McDonnell
    0

    The main reason for this is our indexes are not updating frequently enough when we have deletions, and always appears to be not optimized unless manually done from the admin screen

Please Sign in or register to post replies

Write your reply to:

Draft