搜索显示模板-它们是累积的 [英] Search Display templates - are they cumulative

查看:71
本文介绍了搜索显示模板-它们是累积的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎找不到答案. OOTB,是否每个商品都要通过模板"Item_default"然后在结果中定义一个(例如:excel映射到Excel Item)或仅通过"Excel Item" 模板.问题是我有两种内容类型:CT1和CT2.对于这两种内容类型,我都会在添加日期"中添加创建日期"在超链接下.我创建了Item_default的副本,将其命名为Item_default_MT,并添加了使用此模板的搜索结果 如果使用任一CT.现在,要求是改变身体"结构. (超链接上方的文本),但仅适用于CT2.因此,问题是我是否需要创建一个Item_default_MT2,其中包括Item_default_MT1中的更改​​和新信息. 然后将Item_default_MT1设置为CT1,将Item_default_MT2设置为CT2吗?

基本问题是:结果要先通过此模板,然后再通过该模板,还是只使用一个模板. (也不是在谈论Hoverpanel模板)

谢谢

解决方案

SharePoint显示模板将呈现为控制模板+项目模板. /span>


根据您的要求,我认为您可以在自己的内容中添加内容类型ID自定义模板,根据内容类型id,显示不同的正文.

例如:

在属性映射中添加ContentTypeId.

< mso:ManagedPropertyMapping msdt:dt ="string"> ;&#39;&#39;:&#39;,&#39; Path&#39;:&#39; Path&#39;,&#39; ContentTypeId&#39;:&#39; ContentTypeId&#39;,&#39; PNumberOWSTEXT,&#39;:&#39; PNumberOWSTEXT,&#39; Description& ;#39;:&#39;,EditorOWSUSER&#39;:&#39; EditorOWSUSER&#39;,LastModifiedTime&#39;:& ;#39; LastModifiedTime&#39;,&#39; CollapsingStatus&#39;:&#39; DocId':&#39; DocId& #39;,&#39; HitHighlightedSummary&#39;:&#39; HitHighlightedProperties&#39;:&#39; HitHighlightedProperties',&#39 #39; FileExtension':&#39; Filestension',&#39; ViewsLifeTime&#39;:&#39; ViewsLifeTime&#39;,&## 39; ParentLink':&#39; ParentLink',&#39; FileType&#39;:&#39; FileType&#39;,IsContainer&#39 ;:&#39; IsContainer&#39;,' SecondaryFileExtension&#39;:&#39; DisplayAuthor&#39;:&#39 ; DisplayAuthor&#39;</mso:ManagedPropertyMapping>

检查显示模板中的内容类型ID.


采样结果:


解决方案

Hi,

SharePoint display template will be render as Control Template +Item Template.


For your requirement, I think you could add content type id in your custom template, based on content type id, display the different body.

For example:

Add ContentTypeId in property mapping.

<mso:ManagedPropertyMapping msdt:dt="string">&#39;Title&#39;:&#39;Title&#39;,&#39;Path&#39;:&#39;Path&#39;,&#39;ContentTypeId&#39;:&#39;ContentTypeId&#39;,&#39;PNumberOWSTEXT,&#39;:,&#39;PNumberOWSTEXT,&#39;,&#39;Description&#39;:&#39;Description&#39;,&#39;EditorOWSUSER&#39;:&#39;EditorOWSUSER&#39;,&#39;LastModifiedTime&#39;:&#39;LastModifiedTime&#39;,&#39;CollapsingStatus&#39;:&#39;CollapsingStatus&#39;,&#39;DocId&#39;:&#39;DocId&#39;,&#39;HitHighlightedSummary&#39;:&#39;HitHighlightedSummary&#39;,&#39;HitHighlightedProperties&#39;:&#39;HitHighlightedProperties&#39;,&#39;FileExtension&#39;:&#39;FileExtension&#39;,&#39;ViewsLifeTime&#39;:&#39;ViewsLifeTime&#39;,&#39;ParentLink&#39;:&#39;ParentLink&#39;,&#39;FileType&#39;:&#39;FileType&#39;,&#39;IsContainer&#39;:&#39;IsContainer&#39;,&#39;SecondaryFileExtension&#39;:&#39;SecondaryFileExtension&#39;,&#39;DisplayAuthor&#39;:&#39;DisplayAuthor&#39;</mso:ManagedPropertyMapping>

Check content type id in display template.


Sample result:


 

Best Regards,

Lee


这篇关于搜索显示模板-它们是累积的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆