Adds test

This commit is contained in:
Shannon
2018-11-26 17:20:15 +11:00
parent 9368c71ced
commit b6790261c4
25 changed files with 234 additions and 121 deletions

View File

@@ -123,22 +123,22 @@ namespace Umbraco.Web.Models.Mapping
.AfterMap((src, dest) =>
{
//get the icon if there is one
dest.Icon = src.Fields.ContainsKey(UmbracoExamineIndexer.IconFieldName)
? src.Fields[UmbracoExamineIndexer.IconFieldName]
dest.Icon = src.Values.ContainsKey(UmbracoExamineIndexer.IconFieldName)
? src.Values[UmbracoExamineIndexer.IconFieldName]
: "icon-document";
dest.Name = src.Fields.ContainsKey("nodeName") ? src.Fields["nodeName"] : "[no name]";
if (src.Fields.ContainsKey(UmbracoExamineIndexer.NodeKeyFieldName))
dest.Name = src.Values.ContainsKey("nodeName") ? src.Values["nodeName"] : "[no name]";
if (src.Values.ContainsKey(UmbracoExamineIndexer.NodeKeyFieldName))
{
Guid key;
if (Guid.TryParse(src.Fields[UmbracoExamineIndexer.NodeKeyFieldName], out key))
if (Guid.TryParse(src.Values[UmbracoExamineIndexer.NodeKeyFieldName], out key))
{
dest.Key = key;
//need to set the UDI
if (src.Fields.ContainsKey(LuceneIndexer.CategoryFieldName))
if (src.Values.ContainsKey(LuceneIndexer.CategoryFieldName))
{
switch (src.Fields[LuceneIndexer.CategoryFieldName])
switch (src.Values[LuceneIndexer.CategoryFieldName])
{
case IndexTypes.Member:
dest.Udi = new GuidUdi(Constants.UdiEntityType.Member, dest.Key);
@@ -154,10 +154,10 @@ namespace Umbraco.Web.Models.Mapping
}
}
if (src.Fields.ContainsKey("parentID"))
if (src.Values.ContainsKey("parentID"))
{
int parentId;
if (int.TryParse(src.Fields["parentID"], out parentId))
if (int.TryParse(src.Values["parentID"], out parentId))
{
dest.ParentId = parentId;
}
@@ -166,11 +166,11 @@ namespace Umbraco.Web.Models.Mapping
dest.ParentId = -1;
}
}
dest.Path = src.Fields.ContainsKey(UmbracoExamineIndexer.IndexPathFieldName) ? src.Fields[UmbracoExamineIndexer.IndexPathFieldName] : "";
dest.Path = src.Values.ContainsKey(UmbracoExamineIndexer.IndexPathFieldName) ? src.Values[UmbracoExamineIndexer.IndexPathFieldName] : "";
if (src.Fields.ContainsKey(LuceneIndexer.ItemTypeFieldName))
if (src.Values.ContainsKey(LuceneIndexer.ItemTypeFieldName))
{
dest.AdditionalData.Add("contentType", src.Fields[LuceneIndexer.ItemTypeFieldName]);
dest.AdditionalData.Add("contentType", src.Values[LuceneIndexer.ItemTypeFieldName]);
}
});