U4-9335 - UmbracoExamine needs to ignore the useTempStorage option if an IDirectoryFactory config option is supplied by the indexer

Created by Shannon Deminick 03 Jan 2017, 08:36:26 Updated by Morten Christensen 09 Mar 2017, 12:48:02

Tags: Unscheduled

Relates to: U4-9691

Relates to: UAASSCRUM-712

Subtask of: UAASSCRUM-721

In Examine 0.1.70 an IDirectoryFactory can be defined by config, this supercedes the useTempStorage option which existed only in umbraco (not in Examine) to get around the problem of Lucene files on a remote file share.

UmbracoExamine logic now needs to check if the IDirectoryFactory is assigned and if so, then ignore any useTempStorage option defined.

Comments

Shannon Deminick 03 Jan 2017, 08:40:21

PR: https://github.com/umbraco/Umbraco-CMS/pull/1669

Test notes coming soon


Shannon Deminick 04 Jan 2017, 06:10:11

To test:

  • Stop IIS express for Umbraco
  • Delete App_Data/TEMP/ExamineIndexes
  • Change all of your indexers and searchers to have useTempStorage="LocalOnly"
  • Compile and start your site, no index files should be created at app_data/temp/examineindexes/* (there may be folders made but verify no files exist). This means your index files are being stored in asp.net temp storage
  • Now, put this class in your App_Code:
using System;
using System.Collections.Generic;
using System.Linq;
using Lucene.Net.Store;
using Examine.LuceneEngine.Providers;
using System.IO;

namespace TestClasses
{
    public class DefaultDirectoryFactory : IDirectoryFactory
    {
        public Lucene.Net.Store.Directory CreateDirectory(LuceneIndexer indexer, string luceneIndexFolder)
        {
            var master = new DirectoryInfo(luceneIndexFolder);
            return new SimpleFSDirectory(master);
        }        
    }
}
  • Then add this attribute to all your indexers/searchers: directoryFactory="TestClasses.DefaultDirectoryFactory,App_Code.dll" ** NOTE: Examine doesn't require this attribute on the searcher but in order for us to bypass UmbracoExamine's useTempStorage setting, something needs to be declared for the searchers.
  • Start your site, you should see the indexes be rebuilt and stored in app_data/temp/examine indexes
  • Once that is done, test searching in the back office and ensure it works


Jeroen Breuer 04 Jan 2017, 08:59:22

Do these improvements also affect the AzureDirectory implementation for Examine? https://our.umbraco.org/forum/extending-umbraco-and-using-the-api/78818-using-azuredirectory-with-examine


Shannon Deminick 04 Jan 2017, 09:08:02

@jbreuer no. I know you are dying for me to look into this and it's on my never ending growing list, i have not forgotten. This is not an 'improvement', this is a required work around for eventually getting IDirectoryFactory in Examine working (i.e. like the azure directory stuff)


Alex Lindgren 11 Jan 2017, 15:01:54

Can we now store indexes outside of App Data? Is there documentation on how to do this? And for Umbraco Cloud?


Shannon Deminick 11 Jan 2017, 23:59:11

@Alex.Lindgren not quite yet, you sort of can with Sync vs LocalOnly https://our.umbraco.org/Documentation/Umbraco-Cloud/Set-Up/Examine-Configuration/ but in an upcoming Examine version we have an IDirectoryFactory so yes, you could store them where you like. There's no docs on this right now.


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Very Easy

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.5.7

Sprint: Sprint 49

Story Points:

Cycle: