U4-10587 Email field in InternalMemberIndex seems to be attempted to being added to the index twice
This commit is contained in:
@@ -150,7 +150,7 @@ namespace UmbracoExamine
|
||||
{
|
||||
//By default, we will be using the UmbracoDataService
|
||||
//generally this would only need to be set differently for unit testing
|
||||
DataService = new UmbracoDataService();
|
||||
DataService = CreateDefaultUmbracoDataService();
|
||||
}
|
||||
|
||||
DataService.LogService.LogLevel = LoggingLevel.Normal;
|
||||
@@ -206,10 +206,15 @@ namespace UmbracoExamine
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected virtual IDataService CreateDefaultUmbracoDataService()
|
||||
{
|
||||
return new UmbracoDataService();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to aquire the internal searcher
|
||||
/// </summary>
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace UmbracoExamine.DataServices
|
||||
{
|
||||
public class UmbracoContentService : IContentService
|
||||
{
|
||||
private readonly ApplicationContext _applicationContext;
|
||||
protected ApplicationContext ApplicationContext { get; private set; }
|
||||
|
||||
public UmbracoContentService()
|
||||
: this(ApplicationContext.Current)
|
||||
@@ -21,7 +21,7 @@ namespace UmbracoExamine.DataServices
|
||||
|
||||
public UmbracoContentService(ApplicationContext applicationContext)
|
||||
{
|
||||
_applicationContext = applicationContext;
|
||||
ApplicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -60,11 +60,11 @@ namespace UmbracoExamine.DataServices
|
||||
using (var scope = ApplicationContext.Current.ScopeProvider.CreateScope())
|
||||
{
|
||||
var xmlContent = XDocument.Parse("<content></content>");
|
||||
var rootContent = _applicationContext.Services.ContentService.GetRootContent();
|
||||
var rootContent = ApplicationContext.Services.ContentService.GetRootContent();
|
||||
foreach (var c in rootContent)
|
||||
{
|
||||
// not sure this uses the database, but better be save
|
||||
xmlContent.Root.Add(c.ToDeepXml(_applicationContext.Services.PackagingService));
|
||||
xmlContent.Root.Add(c.ToDeepXml(ApplicationContext.Services.PackagingService));
|
||||
}
|
||||
var result = ((IEnumerable)xmlContent.XPathEvaluate(xpath)).Cast<XElement>();
|
||||
scope.Complete();
|
||||
@@ -82,7 +82,7 @@ namespace UmbracoExamine.DataServices
|
||||
{
|
||||
using (var scope = ApplicationContext.Current.ScopeProvider.CreateScope())
|
||||
{
|
||||
var ret = _applicationContext.Services.PublicAccessService.IsProtected(path.EnsureEndsWith("," + nodeId));
|
||||
var ret = ApplicationContext.Services.PublicAccessService.IsProtected(path.EnsureEndsWith("," + nodeId));
|
||||
scope.Complete();
|
||||
return ret;
|
||||
}
|
||||
@@ -93,14 +93,26 @@ namespace UmbracoExamine.DataServices
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
public IEnumerable<string> GetAllUserPropertyNames()
|
||||
public virtual IEnumerable<string> GetAllUserPropertyNames()
|
||||
{
|
||||
using (var scope = ApplicationContext.Current.ScopeProvider.CreateScope())
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _applicationContext.DatabaseContext.Database.Fetch<string>("select distinct alias from cmsPropertyType order by alias");
|
||||
scope.Complete();
|
||||
{
|
||||
//only return the property type aliases for media and content
|
||||
|
||||
var result = ApplicationContext.DatabaseContext.Database.Fetch<string>(
|
||||
@"select distinct cmsPropertyType.alias from cmsPropertyType
|
||||
inner join cmsContentType on cmsContentType.nodeId = cmsPropertyType.contentTypeId
|
||||
inner join umbracoNode on umbracoNode.id = cmsContentType.nodeId
|
||||
where umbracoNode.nodeObjectType = @contentNodeObjectType OR umbracoNode.nodeObjectType = @mediaNodeObjectType
|
||||
order by alias", new
|
||||
{
|
||||
contentNodeObjectType = Constants.ObjectTypes.DocumentType,
|
||||
mediaNodeObjectType = Constants.ObjectTypes.MediaType
|
||||
});
|
||||
|
||||
scope.Complete();
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
namespace UmbracoExamine.DataServices
|
||||
{
|
||||
public class UmbracoMemberContentService : UmbracoContentService
|
||||
{
|
||||
public override IEnumerable<string> GetAllUserPropertyNames()
|
||||
{
|
||||
using (var scope = ApplicationContext.Current.ScopeProvider.CreateScope())
|
||||
{
|
||||
try
|
||||
{
|
||||
//only return the property type aliases for members
|
||||
|
||||
var result = ApplicationContext.DatabaseContext.Database.Fetch<string>(
|
||||
@"select distinct cmsPropertyType.alias from cmsPropertyType
|
||||
inner join cmsContentType on cmsContentType.nodeId = cmsPropertyType.contentTypeId
|
||||
inner join umbracoNode on umbracoNode.id = cmsContentType.nodeId
|
||||
where umbracoNode.nodeObjectType = @nodeObjectType
|
||||
order by alias", new {nodeObjectType = Constants.ObjectTypes.MemberType});
|
||||
|
||||
scope.Complete();
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<UmbracoMemberContentService>("EXCEPTION OCCURRED reading GetAllUserPropertyNames", ex);
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
src/UmbracoExamine/DataServices/UmbracoMemberDataService.cs
Normal file
10
src/UmbracoExamine/DataServices/UmbracoMemberDataService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace UmbracoExamine.DataServices
|
||||
{
|
||||
public class UmbracoMemberDataService : UmbracoDataService
|
||||
{
|
||||
public UmbracoMemberDataService()
|
||||
{
|
||||
ContentService = new UmbracoMemberContentService();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,6 +119,8 @@
|
||||
<Compile Include="DataServices\UmbracoDataService.cs" />
|
||||
<Compile Include="DataServices\UmbracoContentService.cs" />
|
||||
<Compile Include="DataServices\UmbracoMediaService.cs" />
|
||||
<Compile Include="DataServices\UmbracoMemberContentService.cs" />
|
||||
<Compile Include="DataServices\UmbracoMemberDataService.cs" />
|
||||
<Compile Include="DeletePolicyTracker.cs" />
|
||||
<Compile Include="ExamineHelper.cs" />
|
||||
<Compile Include="IndexTypes.cs" />
|
||||
|
||||
@@ -19,6 +19,8 @@ using Lucene.Net.Analysis;
|
||||
namespace UmbracoExamine
|
||||
{
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Custom indexer for members
|
||||
/// </summary>
|
||||
@@ -101,6 +103,11 @@ namespace UmbracoExamine
|
||||
_memberTypeService = memberTypeService;
|
||||
}
|
||||
|
||||
protected override IDataService CreateDefaultUmbracoDataService()
|
||||
{
|
||||
return new UmbracoMemberDataService();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that the'_searchEmail' is added to the user fields so that it is indexed - without having to modify the config
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user