1

I have a number of FAQ lists spread around my site collection (SharePoint 2013 On premises). These lists have special content type, "FAQ Item", that basically has columns for Question, Answer, Area and Topic.

To aggregate all the FAQ items I have a search page, where I get all the items with content type "FAQ Item".

Now I am trying to make a search display template for the FAQ lists for a FAQ search page. I have copied the Item_Default template and added my managed properties at the end of the ManagedPropertyMapping list and I have added them to the div section in the diplay template:

       <div id="_#= $htmlEncode(itemId) =#_" name="Item" data-displaytemplate="DefaultItem" class="ms-srch-item" onmouseover="_#= ctx.currentItem_ShowHoverPanelCallback =#_" onmouseout="_#= ctx.currentItem_HideHoverPanelCallback =#_">
            _#=ctx.RenderBody(ctx)=#_
            <div>_#= STSHtmlDecode(ctx.CurrentItem.AnswerOWSMTXT) =#_</div>         
            <div>_#= STSHtmlDecode(ctx.CurrentItem.Answer0OWSMTXT) =#_</div>
            <div>_#= ctx.CurrentItem.TopicOWSCHCS =#_</div>
            <div id="_#= $htmlEncode(hoverId) =#_" class="ms-srch-hover-outerContainer"></div>
        </div>

The search returns the correct items and I am able to use refiners on tags and topics. But the search results are only displaying the title (the question), a link to the list item and the topic. No parts of the answer is being displayed.

I would like the question, the answer (either the whole answer or like 3 lines of the answer) and the topic to be displayed.

How can I get the answers to be displayed?

1

Did you follow the below step(see image) mentioned in the article, https://blogs.technet.microsoft.com/tothesharepoint/2013/09/06/how-to-display-values-from-custom-managed-properties-in-search-results-option-1/

enter image description here

  • Yes, I followed the steps in that article. It was a very useful article! When I added TopicOWSCHCS to ManagedPropertyMapping I got that notification about property sync. But when I added AnswerOWSMTXT there was no notification. When still no answers were being displayed, I found Answer0OWSMTXT and added that to ManagedPropertyMapping also. There was no property sync alert that time either. If it is a missing property sync that is causing the answers not to be displayed, how can I fix that? – Gunilla Jan 21 '16 at 16:21
  • Try to add a console.log(ctx.CurrentItem) inside the javascript and look at the developer tools to see if you find the missing properties – Shashank Reddy K Jan 21 '16 at 16:52
  • I ran F12 and reloaded the page after I had added a "console.log(ctx.CurrentItem)" to the custom item display template. I can see a lot of properties, including TopicOWSCHCS and Title. But there is no sign of anything like AnswerOWSMTXT in the console output. – Gunilla Jan 22 '16 at 16:27
  • Obviously, I do not have access to AnswerOWSMTXT because I did not get any property sync alert. Is there anything I can do to get a property sync now? – Gunilla Jan 25 '16 at 16:33
  • I have found out was the problem was: When I added the properties to the ManagedPropertyMapping section, this section was not very readable because of all the &#39; stuff, so I missed to add the commas between the properties. This caused the properties not to sync. The Topic property was not affected by this since I added it first. Anyway, I will mark your answer as the answer since the missing property sync was the clue to solve this problem. Thank you very much! – Gunilla Jan 25 '16 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.