diff --git a/src/NuGet.Config b/src/NuGet.Config
index dcccfdd5c1..2cb8d8dfbd 100644
--- a/src/NuGet.Config
+++ b/src/NuGet.Config
@@ -3,5 +3,6 @@
+
\ No newline at end of file
diff --git a/src/Umbraco.Examine/BaseUmbracoIndexer.cs b/src/Umbraco.Examine/BaseUmbracoIndexer.cs
deleted file mode 100644
index 24d3168240..0000000000
--- a/src/Umbraco.Examine/BaseUmbracoIndexer.cs
+++ /dev/null
@@ -1,459 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using Examine.LuceneEngine.Config;
-using Examine.LuceneEngine.Providers;
-using Examine.Providers;
-using Lucene.Net.Analysis;
-using Lucene.Net.Index;
-using Umbraco.Core;
-using Examine;
-using System.IO;
-using System.Xml;
-using System.Xml.Linq;
-using Examine.LuceneEngine;
-using Examine.LuceneEngine.Faceting;
-using Examine.LuceneEngine.Indexing;
-using Lucene.Net.Documents;
-using Lucene.Net.Store;
-using Umbraco.Core.Composing;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Xml;
-using Umbraco.Examine.LocalStorage;
-using Directory = Lucene.Net.Store.Directory;
-
-namespace Umbraco.Examine
-{
- ///
- /// An abstract provider containing the basic functionality to be able to query against
- /// Umbraco data.
- ///
- public abstract class BaseUmbracoIndexer : LuceneIndexer
- {
- // note
- // wrapping all operations that end up calling base.SafelyProcessQueueItems in a safe call
- // context because they will fork a thread/task/whatever which should *not* capture our
- // call context (and the database it can contain)! ideally we should be able to override
- // SafelyProcessQueueItems but that's not possible in the current version of Examine.
-
- ///
- /// Used to store the path of a content object
- ///
- public const string IndexPathFieldName = "__Path";
- public const string NodeKeyFieldName = "__Key";
- public const string IconFieldName = "__Icon";
- public const string PublishedFieldName = "__Published";
- ///
- /// The prefix added to a field when it is duplicated in order to store the original raw value.
- ///
- public const string RawFieldPrefix = "__Raw_";
-
- ///
- /// Default constructor
- ///
- protected BaseUmbracoIndexer()
- : base()
- {
- ProfilingLogger = Current.ProfilingLogger;
- _configBased = true;
- }
-
- protected BaseUmbracoIndexer(
- IEnumerable fieldDefinitions,
- Directory luceneDirectory,
- Analyzer defaultAnalyzer,
- ProfilingLogger profilingLogger,
- IValueSetValidator validator = null,
- FacetConfiguration facetConfiguration = null, IDictionary> indexValueTypes = null)
- : base(fieldDefinitions, luceneDirectory, defaultAnalyzer, validator, facetConfiguration, indexValueTypes)
- {
- if (profilingLogger == null) throw new ArgumentNullException("profilingLogger");
- ProfilingLogger = profilingLogger;
- }
-
- private readonly bool _configBased = false;
- private LocalTempStorageIndexer _localTempStorageIndexer;
-
- ///
- /// A type that defines the type of index for each Umbraco field (non user defined fields)
- /// Alot of standard umbraco fields shouldn't be tokenized or even indexed, just stored into lucene
- /// for retreival after searching.
- ///
- [Obsolete("IndexFieldPolicies is not really used apart for some legacy reasons - use FieldDefinition's instead")]
- internal static readonly List IndexFieldPolicies
- = new List
- {
- new StaticField("id", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
- new StaticField("key", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
- new StaticField( "version", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
- new StaticField( "parentID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
- new StaticField( "level", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"),
- new StaticField( "writerID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
- new StaticField( "creatorID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
- new StaticField( "nodeType", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
- new StaticField( "template", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
- new StaticField( "sortOrder", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"),
- new StaticField( "createDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"),
- new StaticField( "updateDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"),
- new StaticField( "nodeName", FieldIndexTypes.ANALYZED, false, string.Empty),
- new StaticField( "urlName", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
- new StaticField( "writerName", FieldIndexTypes.ANALYZED, false, string.Empty),
- new StaticField( "creatorName", FieldIndexTypes.ANALYZED, false, string.Empty),
- new StaticField( "nodeTypeAlias", FieldIndexTypes.ANALYZED, false, string.Empty),
- new StaticField( "path", FieldIndexTypes.NOT_ANALYZED, false, string.Empty)
- };
-
- protected ProfilingLogger ProfilingLogger { get; private set; }
-
- ///
- /// Overridden to ensure that the umbraco system field definitions are in place
- ///
- ///
- ///
- protected override IEnumerable InitializeFieldDefinitions(IEnumerable originalDefinitions)
- {
- var fd = base.InitializeFieldDefinitions(originalDefinitions).ToList();
- fd.AddRange(new[]
- {
- new FieldDefinition("parentID", FieldDefinitionTypes.Integer),
- new FieldDefinition("level", FieldDefinitionTypes.Integer),
- new FieldDefinition("writerID", FieldDefinitionTypes.Integer),
- new FieldDefinition("creatorID", FieldDefinitionTypes.Integer),
- new FieldDefinition("sortOrder", FieldDefinitionTypes.Integer),
- new FieldDefinition("template", FieldDefinitionTypes.Integer),
-
- new FieldDefinition("createDate", FieldDefinitionTypes.DateTime),
- new FieldDefinition("updateDate", FieldDefinitionTypes.DateTime),
-
- new FieldDefinition("key", FieldDefinitionTypes.Raw),
- new FieldDefinition("version", FieldDefinitionTypes.Raw),
- new FieldDefinition("nodeType", FieldDefinitionTypes.Raw),
- new FieldDefinition("template", FieldDefinitionTypes.Raw),
- new FieldDefinition("urlName", FieldDefinitionTypes.Raw),
- new FieldDefinition("path", FieldDefinitionTypes.Raw),
-
- new FieldDefinition(IndexPathFieldName, FieldDefinitionTypes.Raw),
- new FieldDefinition(NodeTypeAliasFieldName, FieldDefinitionTypes.Raw),
- new FieldDefinition(IconFieldName, FieldDefinitionTypes.Raw)
- });
- return fd;
- }
-
- public bool UseTempStorage
- {
- get { return _localTempStorageIndexer != null && _localTempStorageIndexer.LuceneDirectory != null; }
- }
-
- public string TempStorageLocation
- {
- get
- {
- if (UseTempStorage == false) return string.Empty;
- return _localTempStorageIndexer.TempPath;
- }
- }
-
- [Obsolete("This should not be used, it is used by the configuration based indexes but instead to disable Examine event handlers use the ExamineEvents class instead.")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public bool EnableDefaultEventHandler { get; protected set; }
-
- ///
- /// the supported indexable types
- ///
- protected abstract IEnumerable SupportedTypes { get; }
-
- #region Initialize
-
-
- ///
- /// Setup the properties for the indexer from the provider settings
- ///
- ///
- ///
- ///
- /// This is ONLY used for configuration based indexes
- ///
- public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
- {
- EnableDefaultEventHandler = true; //set to true by default
- bool enabled;
- if (bool.TryParse(config["enableDefaultEventHandler"], out enabled))
- {
- EnableDefaultEventHandler = enabled;
- }
-
- ProfilingLogger.Logger.Debug(GetType(), "{0} indexer initializing", () => name);
-
- base.Initialize(name, config);
-
- //NOTES: useTempStorage is obsolete, tempStorageDirectory is obsolete, both have been superceded by Examine Core's IDirectoryFactory
- // tempStorageDirectory never actually got finished in Umbraco Core but accidentally got shipped (it's only enabled on the searcher
- // and not the indexer). So this whole block is just legacy
-
- //detect if a dir factory has been specified, if so then useTempStorage will not be used (deprecated)
-
- if (config["directoryFactory"] == null && config["useTempStorage"] != null)
- {
- throw new NotImplementedException("Fix how local temp storage works and is synced with Examine v2.0 - since a writer is always open we cannot snapshot it, we need to use the same logic in AzureDirectory");
-
- _localTempStorageIndexer = new LocalTempStorageIndexer();
-
- var fsDir = base.GetLuceneDirectory() as FSDirectory;
- if (fsDir != 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;
-
- _localTempStorageIndexer.Initialize(config, configuredPath, fsDir, IndexingAnalyzer, attemptUseTempStorage.Result);
- }
- }
-
- }
- }
-
- #endregion
-
-
- public override Directory GetLuceneDirectory()
- {
- //if temp local storage is configured use that, otherwise return the default
- if (UseTempStorage)
- {
- return _localTempStorageIndexer.LuceneDirectory;
- }
-
- return base.GetLuceneDirectory();
-
- }
-
- ///
- /// override to check if we can actually initialize.
- ///
- ///
- /// This check is required since the base examine lib will try to rebuild on startup
- ///
- public override void RebuildIndex()
- {
- if (CanInitialize())
- {
- ProfilingLogger.Logger.Debug(GetType(), "Rebuilding index");
- using (new SafeCallContext())
- {
- base.RebuildIndex();
- }
- }
- }
-
- ///
- /// override to check if we can actually initialize.
- ///
- ///
- /// This check is required since the base examine lib will try to rebuild on startup
- ///
- public override void IndexAll(string type)
- {
- if (CanInitialize())
- {
- using (new SafeCallContext())
- {
- base.IndexAll(type);
- }
- }
- }
-
- public override void IndexItems(IEnumerable nodes)
- {
- if (CanInitialize())
- {
- using (new SafeCallContext())
- {
- base.IndexItems(nodes);
- }
- }
- }
-
- [Obsolete("Use ValueSets with IndexItems instead")]
- public override void ReIndexNode(XElement node, string type)
- {
- if (CanInitialize())
- {
- if (SupportedTypes.Contains(type) == false)
- return;
-
- if (node.Attribute("id") != null)
- {
- ProfilingLogger.Logger.Debug(GetType(), "ReIndexNode {0} with type {1}", () => node.Attribute("id"), () => type);
- using (new SafeCallContext())
- {
- base.ReIndexNode(node, type);
- }
- }
- else
- {
- ProfilingLogger.Logger.Error(GetType(), "ReIndexNode cannot proceed, the format of the XElement is invalid",
- new XmlException("XElement is invalid, the xml has not id attribute"));
- }
- }
- }
-
- ///
- /// override to check if we can actually initialize.
- ///
- ///
- /// This check is required since the base examine lib will try to rebuild on startup
- ///
- public override void DeleteFromIndex(string nodeId)
- {
- if (CanInitialize())
- {
- using (new SafeCallContext())
- {
- base.DeleteFromIndex(nodeId);
- }
- }
- }
-
- ///
- /// Returns true if the Umbraco application is in a state that we can initialize the examine indexes
- ///
- protected bool CanInitialize()
- {
- // only affects indexers that are config file based, if an index was created via code then
- // this has no effect, it is assumed the index would not be created if it could not be initialized
- return _configBased == false || Current.RuntimeState.Level == RuntimeLevel.Run;
- }
-
- ///
- /// Reindexes all supported types
- ///
- protected override void PerformIndexRebuild()
- {
- foreach (var t in SupportedTypes)
- {
- IndexAll(t);
- }
- }
-
- ///
- /// overridden for logging
- ///
- ///
- protected override void OnIndexingError(IndexingErrorEventArgs e)
- {
- ProfilingLogger.Logger.Error(GetType(), e.Message, e.Exception);
- base.OnIndexingError(e);
- }
-
- ///
- /// Override for logging
- ///
- ///
- protected override void OnIgnoringIndexItem(IndexItemEventArgs e)
- {
- ProfilingLogger.Logger.Debug(GetType(), "OnIgnoringIndexItem {0} with type {1}", () => e.IndexItem.ValueSet.Id, () => e.IndexItem.ValueSet.IndexCategory);
- base.OnIgnoringIndexItem(e);
- }
-
- ///
- /// This ensures that the special __Raw_ fields are indexed
- ///
- ///
- protected override void OnDocumentWriting(DocumentWritingEventArgs docArgs)
- {
- var d = docArgs.Document;
-
- foreach (var f in docArgs.Values.Values.Where(x => x.Key.StartsWith(RawFieldPrefix)))
- {
- if (f.Value.Count > 0)
- {
- d.Add(new Field(
- f.Key,
- f.Value[0].ToString(),
- Field.Store.YES,
- Field.Index.NO, //don't index this field, we never want to search by it
- Field.TermVector.NO));
- }
- }
-
- ProfilingLogger.Logger.Debug(GetType(), "OnDocumentWriting {0} with type {1}", () => docArgs.Values.Id, () => docArgs.Values.ItemType);
-
- base.OnDocumentWriting(docArgs);
- }
-
- protected override void OnItemIndexed(IndexItemEventArgs e)
- {
- ProfilingLogger.Logger.Debug(GetType(), "Index created for node {0}", () => e.IndexItem.Id);
- base.OnItemIndexed(e);
- }
-
- protected override void OnIndexDeleted(DeleteIndexEventArgs e)
- {
- ProfilingLogger.Logger.Debug(GetType(), "Index deleted for term: {0} with value {1}", () => e.DeletedTerm.Key, () => e.DeletedTerm.Value);
- base.OnIndexDeleted(e);
- }
-
- [Obsolete("This is no longer used, index optimization is no longer managed with the LuceneIndexer")]
- protected override void OnIndexOptimizing(EventArgs e)
- {
- ProfilingLogger.Logger.Debug(GetType(), "Index is being optimized");
- base.OnIndexOptimizing(e);
- }
-
- ///
- /// Overridden for logging.
- ///
- ///
- protected override void AddDocument(ValueSet values)
- {
- ProfilingLogger.Logger.Debug(GetType(), "AddDocument {0} with type {1}", () => values.Id, () => values.ItemType);
- base.AddDocument(values);
- }
-
- protected override void OnTransformingIndexValues(TransformingIndexDataEventArgs e)
- {
- base.OnTransformingIndexValues(e);
-
- //ensure special __Path field
- if (e.OriginalValues.ContainsKey("path") && e.IndexItem.ValueSet.Values.ContainsKey(IndexPathFieldName) == false)
- {
- e.IndexItem.ValueSet.Values[IndexPathFieldName] = new List