Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Workaround for null issues when indexing #31

Merged
merged 1 commit into from Oct 24, 2015
Merged

Workaround for null issues when indexing #31

merged 1 commit into from Oct 24, 2015

Conversation

nvisage-gf
Copy link

No description provided.

@nvisage-gf
Copy link
Author

Issue arises when Examine is indexing grid nodes with DTGE and Nested Content content that are also indexed; Umbraco 7.3.

Grid content is being indexed using Skybrud.Umbraco.GridData package with this pull request and this gist.

Doc type models are generated using ZpqrtBnk Umbraco Models Builder with a modified PublishedContentModel to handle exceptions (e.g. picker with no value).

    using System;

    using Umbraco.Core.Logging;
    using Umbraco.Core.Models;
    using Umbraco.Web;

    public class PublishedContentModel : Umbraco.Core.Models.PublishedContent.PublishedContentModel
    {
        public PublishedContentModel(IPublishedContent content)
            : base(content)
        {
        }

        public T GetPropertyValue<T>(string alias)
        {
            try
            {
                if (this.Content.HasProperty(alias) && this.Content.HasValue(alias))
                {
                    return PublishedContentExtensions.GetPropertyValue<T>(this.Content, alias);
                }
                else
                {
                    return default(T);
                }
            }
            catch (Exception exception)
            {
                LogHelper.Error<IPublishedContent>(
                    string.Format("Name: {0} - Alias: {1}", this.Content.Name, alias), 
                    exception);
                return default(T);
            }
        }
    }

@leekelleher
Copy link
Collaborator

Thanks @nvisage-gf, we'll review it.

@@ -9,7 +9,6 @@
string docType = Model.value.docType.ToString();
string value = Model.value.value.ToString();
string viewPath = Model.editor.config.viewPath.ToString();
string previewViewPath = Model.editor.config.previewViewPath.ToString();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nvisage-gf Could you add the previewViewPath line back in please? Thanks.

@leekelleher leekelleher added this to the 0.2.0 milestone Oct 22, 2015
@leekelleher leekelleher self-assigned this Oct 22, 2015
@leekelleher
Copy link
Collaborator

@nvisage-gf All looks good, thanks!

Although I think you'll need to rebase on the latest commits - I'd just merged in PR #17 - which causes a merge conflict for your PR.

Issue arises when Examine is indexing grid nodes with DTGE and Nested
Content content that are also indexed, avoid null being cached in case
of conversion issue; Umbraco 7.3.
@nvisage-gf
Copy link
Author

done

leekelleher added a commit that referenced this pull request Oct 24, 2015
Workaround for null issues when indexing
@leekelleher leekelleher merged commit c45989e into skttl:develop Oct 24, 2015
@leekelleher
Copy link
Collaborator

@nvisage-gf Thanks for the PR. 👍 (I forgot to reply the other day)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants