locked
Search Display Template is missing custom Managed Properties RRS feed

  • Question

  • We have created some custom Managed Properties in SharePoint Online for Sites. And selected "Reindex Site".

    And I have created a display template in order to test the custom managed properties.

    I get sites in my search results, but none of the custom managed properties appears. I put  all properties of ctx.CurrentItem in an alert within. and noticed that none og the custom managed properties exists in ctx.CurrentItem.

    I guess that something might be wrong in my display template, but I have no idea what. Hope you can help.

    Kind Regards,

    Jakob

    Display template:

    <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
    <head>
    <title>Site Item</title>

    <!--[if gte mso 9]><xml>
    <mso:CustomDocumentProperties>
    <mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
    <mso:MasterPageDescription msdt:dt="string">Displays a result tailored for a SharePoint site.</mso:MasterPageDescription>
    <mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
    <mso:TargetControlType msdt:dt="string">;#SearchResults;#</mso:TargetControlType>
    <mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
    <mso:ManagedPropertyMapping msdt:dt="string">'RefinableString04':'RefinableString04','LMS365CourseId':'Searchable.LMS365.CourseId','LMS365Duration':'RefinableString02','LMS365CertificateTemplateId':'LMS365.CertificateTemplateId','LMS365Type':'LMS365.Type','LMS365Ceu':'LMS365.Ceu','LMS365Showincatalog':'LMS365.Showincatalog','LMS365Required':'LMS365.Required','LMS365Category':'LMS365.Category','LMS365Tags':'LMS365.Tags,'LMS365Apps':'LMS365.Apps','Title':'Title','Path':'Path','SiteLogo':'SiteLogo','SiteDescription':'SiteDescription','CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension','ViewsLifeTime':'ViewsLifeTime','deeplinks':'deeplinks','importance':'importance','FileType':'FileType'</mso:ManagedPropertyMapping>
    <mso:HtmlDesignConversionSucceeded msdt:dt="string">True</mso:HtmlDesignConversionSucceeded>
    </mso:CustomDocumentProperties>
    </xml><![endif]-->

    </head>
    <body>
        <div id="Item_Site">
    <!--#_
            if(!$isNull(ctx.CurrentItem) && !$isNull(ctx.ClientControl)){
                var id = ctx.ClientControl.get_nextUniqueId();
                var itemId = id + Srch.U.Ids.item;
                var hoverId = id + Srch.U.Ids.hover;
                var hoverUrl = "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Site_HoverPanel.js";
                var deepLinksClassNoEncode = "ms-srch-item-deepLinks";
       $setResultItem(itemId, ctx.CurrentItem);
                if(ctx.CurrentItem.IsContainer)
                {
                        ctx.CurrentItem.csr_Icon = Srch.U.getFolderIconUrl();
                }
                ctx.currentItem_ShowHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
                ctx.currentItem_HideHoverPanelCallback = Srch.U.getHideHoverPanelCallback();

                var varLMS365Imageurl = ctx.CurrentItem.RefinableString04;
                var varLMS365CourseId = $getItemValue(ctx, 'LMS365CourseId');
                var varLMS365Duration = $getItemValue(ctx, 'LMS365Duration');
                var varLMS365CertificateTemplateId = $getItemValue(ctx, 'LMS365CertificateTemplateId');
                var varLMS365Type = $getItemValue(ctx, 'LMS365Type');
                var varLMS365Ceu = ctx.CurrentItem.LMS365Ceu;
                var varLMS365Showincatalog = ctx.CurrentItem.LMS365Showincatalog;
                var varLMS365Required = ctx.CurrentItem.LMS365Required;
                var alertText = 'ctx.CurrentItem:';
                for (var p in ctx.CurrentItem)
             {
                    alertText = alertText + '\n' + p + ' = ' + $getItemValue(ctx, p);
                }
                alert(alertText);
    _#-->
                <div id="_#= $htmlEncode(itemId) =#_" name="Item" data-displaytemplate="SiteItem" class="ms-srch-item" onmouseover="_#= ctx.currentItem_ShowHoverPanelCallback =#_" onmouseout="_#= ctx.currentItem_HideHoverPanelCallback =#_">

    <!--#_
                    if(!$isNull(ctx.CurrentItem.SiteLogo) && !Srch.U.isDefaultSiteLogo(ctx.CurrentItem.SiteLogo)){
         ctx.CurrentItem.csr_PathLength = Srch.U.pathTruncationLengthWithPreview;
         ctx.CurrentItem.csr_PreviewImage = ctx.CurrentItem.SiteLogo;
                        ctx.CurrentItem.csr_PreviewImageAltText = Srch.Res.hp_Alt_SiteLogo;
                    } else {
                        deepLinksClassNoEncode += " ms-srch-item-deepLinks-noPreview";
                    }
    _#-->    
        _#=ctx.RenderBody(ctx)=#_    
    <!--#_
        if(!Srch.U.e(ctx.CurrentItem.deeplinks) && !Srch.U.n(ctx.CurrentItem.importance)){
    _#-->
         <div class="_#= deepLinksClassNoEncode =#_" id="_#= $htmlEncode(id + Srch.U.Ids.deepLinks) =#_">
          _#= Srch.U.getDeepLinks(ctx.CurrentItem.deeplinks, ctx.CurrentItem.importance) =#_
         </div>
    <!--#_
        }
    _#-->   
                    <div><input type="button" onclick="alert('Enroll not implmented')" value="Enroll" style="float:right; margin-top: 10px" /></div>
                    <div style="float:none;">
                        LMS365Imageurl: _#= varLMS365Imageurl =#_ |
                        LMS365CourseId: _#= varLMS365CourseId =#_  |
                        LMS365Duration: _#= varLMS365Duration =#_  |
                        LMS365ertificateTemplateId: _#= varLMS365CertificateTemplateId =#_ |
                        LMS365Type: _#= varLMS365Type =#_  |
                        LMS365Ceu: _#= varLMS365Ceu =#_  |
                        LMS365Showincatalog: _#= varLMS365Showincatalog =#_  |
                        LMS365Required: _#= varLMS365Required =#_  |
                        LMS365Category: _#= $htmlEncode(ctx.CurrentItem.LMS365Category) =#_ _#= $getItemValue(ctx, "LMS365Category") =#_  |
                        LMS365Tags: _#= $htmlEncode(ctx.CurrentItem.LMS365Tags) =#_ _#= $getItemValue(ctx, "LMS365Tags") =#_  |
                        LMS365Apps: _#= $htmlEncode(ctx.CurrentItem.LMS365Apps) =#_ _#= $getItemValue(ctx, "LMS365Apps") =#_  | v5
                    </div>
                    <div id="_#= $htmlEncode(hoverId) =#_" class="ms-srch-hover-outerContainer"></div>
                </div>
    <!--#_
            }
    _#-->
        </div>
    </body>
    </html>


    • Edited by Jakob Mathiasen Thursday, March 10, 2016 10:42 AM added signature
    Thursday, March 10, 2016 10:40 AM

Answers

  • Hi Jakob,

    From your description, the value of custom managed properties are missing in display template on SharePoint 2013 Online. Is it right?

    Firstly, please add these custom managed properties as refiners, then search related thing and check if there are values for these custom managed properties. If there is no value for these refiners, there is no value for these managed properties.

    Then go to Site settings –> Result Types. Check if a Property Sync alert is displayed. If yes, please click Update to sync the change.

    There is an article about troubleshooting this issue, please take a look at:

    https://blogs.perficient.com/multi-shoring/blog/2016/02/29/sharepoint-2013-search-missing-managed-property-value/

    In addition, as this issue is related to SharePoint Online, I suggest you create a new thread on Office 365 forum. 

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Office 365 forum:

    https://community.office365.com/en-us/f/

    Best Regards,

    Wendy


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.


    Friday, March 11, 2016 2:05 AM