diff --git a/src/UmbracoExamine/BaseUmbracoIndexer.cs b/src/UmbracoExamine/BaseUmbracoIndexer.cs
index 395b2fef3f..351c7be985 100644
--- a/src/UmbracoExamine/BaseUmbracoIndexer.cs
+++ b/src/UmbracoExamine/BaseUmbracoIndexer.cs
@@ -10,6 +10,7 @@ using Examine.LuceneEngine.Config;
using Examine.LuceneEngine.Providers;
using Lucene.Net.Analysis;
using Lucene.Net.Documents;
+using Lucene.Net.Index;
using Umbraco.Core;
using umbraco.BasePages;
using umbraco.BusinessLogic;
@@ -17,6 +18,7 @@ using UmbracoExamine.DataServices;
using Examine;
using System.IO;
using System.Xml.Linq;
+using UmbracoExamine.LocalStorage;
namespace UmbracoExamine
{
@@ -62,6 +64,7 @@ namespace UmbracoExamine
/// Used for unit tests
///
internal static bool? DisableInitializationCheck = null;
+ private readonly LocalTempStorageIndexer _localTempStorageHelper = new LocalTempStorageIndexer();
#region Properties
@@ -97,7 +100,21 @@ namespace UmbracoExamine
///
///
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
- {
+ {
+ if (config != null && config["useTempStorage"] != null)
+ {
+ //Use the temp storage directory which will store the index in the local/codegen folder, this is useful
+ // for websites that are running from a remove file server and file IO latency becomes an issue
+ var attemptUseTempStorage = config["useTempStorage"].TryConvertTo();
+ if (attemptUseTempStorage)
+ {
+ var indexSet = IndexSets.Instance.Sets[IndexSetName];
+ var configuredPath = indexSet.IndexPath;
+
+ _localTempStorageHelper.Initialize(config, configuredPath, base.GetLuceneDirectory(), IndexingAnalyzer);
+ }
+ }
+
if (config["dataService"] != null && !string.IsNullOrEmpty(config["dataService"]))
{
//this should be a fully qualified type
@@ -148,6 +165,32 @@ namespace UmbracoExamine
#endregion
+ public override Lucene.Net.Store.Directory GetLuceneDirectory()
+ {
+ //if temp local storage is configured use that, otherwise return the default
+ if (_localTempStorageHelper.LuceneDirectory != null)
+ {
+ return _localTempStorageHelper.LuceneDirectory;
+ }
+
+ return base.GetLuceneDirectory();
+
+ }
+
+ public override IndexWriter GetIndexWriter()
+ {
+ //if temp local storage is configured use that, otherwise return the default
+ if (_localTempStorageHelper.LuceneDirectory != null)
+ {
+ return new IndexWriter(GetLuceneDirectory(), IndexingAnalyzer,
+ //create the writer with the snapshotter, though that won't make too much a difference because we are not keeping the writer open unless using nrt
+ // which we are not currently.
+ _localTempStorageHelper.Snapshotter,
+ IndexWriter.MaxFieldLength.UNLIMITED);
+ }
+
+ return base.GetIndexWriter();
+ }
/////
///// Override to check if we can actually initialize.
diff --git a/src/UmbracoExamine/UmbracoContentIndexer.cs b/src/UmbracoExamine/UmbracoContentIndexer.cs
index d154c748a4..26ae4a9f5f 100644
--- a/src/UmbracoExamine/UmbracoContentIndexer.cs
+++ b/src/UmbracoExamine/UmbracoContentIndexer.cs
@@ -122,7 +122,7 @@ namespace UmbracoExamine
#region Constants & Fields
- private readonly LocalTempStorageIndexer _localTempStorageHelper = new LocalTempStorageIndexer();
+
///
/// Used to store the path of a content object
@@ -208,19 +208,7 @@ namespace UmbracoExamine
base.Initialize(name, config);
- if (config != null && config["useTempStorage"] != null)
- {
- //Use the temp storage directory which will store the index in the local/codegen folder, this is useful
- // for websites that are running from a remove file server and file IO latency becomes an issue
- var attemptUseTempStorage = config["useTempStorage"].TryConvertTo();
- if (attemptUseTempStorage)
- {
- var indexSet = IndexSets.Instance.Sets[IndexSetName];
- var configuredPath = indexSet.IndexPath;
-
- _localTempStorageHelper.Initialize(config, configuredPath, base.GetLuceneDirectory(), IndexingAnalyzer);
- }
- }
+
}
@@ -296,32 +284,7 @@ namespace UmbracoExamine
#region Public methods
- public override Lucene.Net.Store.Directory GetLuceneDirectory()
- {
- //if temp local storage is configured use that, otherwise return the default
- if (_localTempStorageHelper.LuceneDirectory != null)
- {
- return _localTempStorageHelper.LuceneDirectory;
- }
-
- return base.GetLuceneDirectory();
-
- }
-
- public override IndexWriter GetIndexWriter()
- {
- //if temp local storage is configured use that, otherwise return the default
- if (_localTempStorageHelper.LuceneDirectory != null)
- {
- return new IndexWriter(GetLuceneDirectory(), IndexingAnalyzer,
- //create the writer with the snapshotter, though that won't make too much a difference because we are not keeping the writer open unless using nrt
- // which we are not currently.
- _localTempStorageHelper.Snapshotter,
- IndexWriter.MaxFieldLength.UNLIMITED);
- }
-
- return base.GetIndexWriter();
- }
+
///