根据网站标题(O365)过滤搜索结果 [英] Filter search results on the basis of Site Title (O365)

查看:106
本文介绍了根据网站标题(O365)过滤搜索结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我显示来自30多个不同SharePoint网站的数据。在搜索结果页面中,我想根据站点名称或站点标题过滤结果。但是在O365中,我们没有基于SiteTitle的选项过滤器,因为它不是可精炼的属性。
相反,我们可以在SPSiteURL的基础上进行优化。但是,网址可能非常冗长,用户很难根据网址进行过滤。我尝试使用友好名称映射RefinementValue,如下所示。 function mapSiteUrl(refinementName)
{var map = {}; map [" MySiteName"] = {" RefinerName":" SPSiteURL"," RefinementValue":" http:// MySiteUrl "
}; map [" MySiteName2"] = {" RefinerName":" SPSiteURL"," RefinementValue":" http:// MySiteUrl2 "
}; map [" MySiteName3"] = {" RefinerName":" SPSiteURL"," RefinementValue":" http:// MySiteUrl3 "
};

I am showing data from 30+ different SharePoint sites. In the search results page i want to filter the result on the basis of Site Name or Site Title. However in O365 we do not have option filter on the basis of SiteTitle as it is not a refinable property. Instead we can refine on the basis of SPSiteURL. However the urls can be very lengthy and it will be very difficult for the users to filter on the basis of URL. I tried to Map the RefinementValue with a friendly name like it is shown below. function mapSiteUrl(refinementName) { var map = {}; map["MySiteName"] = { "RefinerName": "SPSiteURL", "RefinementValue": "http://MySiteUrl" }; map["MySiteName2"] = { "RefinerName": "SPSiteURL", "RefinementValue": "http://MySiteUrl2" }; map["MySiteName3"] = { "RefinerName": "SPSiteURL", "RefinementValue": "http://MySiteUrl3" };

var mappedRefinementName = null;

for (var key in map) {
    if (refinementName.toLowerCase() === map[key].RefinementValue.toLowerCase()) {
        mappedRefinementName = key;
        break;
    }
}
if ($isNull(mappedRefinementName)) {
    mappedRefinementName = refinementName;
}
return mappedRefinementName;



}

}


var listData = ctx.ListData; var hasControl = true; var shortListSize = 5;

var listData = ctx.ListData; var hasControl = true; var shortListSize = 5;


if($ isNull(ctx.RefinementControl)|| $ isNull(ctx.ClientControl))hasControl = false;

if ($isNull(ctx.RefinementControl) || $isNull(ctx.ClientControl)) hasControl = false;


if(ctx.RefinementControl.propertyName ==" SPSiteURL"){shortListSize = 6;

if (ctx.RefinementControl.propertyName == "SPSiteURL") { shortListSize = 6;

for (var i in listData) {
    listData[i].RefinementTokens = [listData[i].RefinementToken];
    listData[i].RefinementName = mapSiteUrl(listData[i].RefinementName);
    listData[i].RefinementTokenWrappedValues = [Srch.RefinementUtil.stringValueToEqualsToken(listData[i].RefinementValue)];            
}        



}

}


但是我不想在再融资模板中对URL进行硬编码。相反,我想从列表中读取它,其中包含URL列表和相应的站点标题。我想阅读从列表中获取值,然后更新细化模板中的映射。
请告诉我是否有任何方法可以完成此操作并根据站点标题过滤搜索结果。

However I do not want to hard code the URL in the refinment template. Instead I want to read it from a list which has list of URLs and the corresponding Site Title. I want to read the value from the list and then update the mapping in the refinement template. Please do let me know if there is any way I can accomplish this and filter the search results based upon site Title.

推荐答案

只需重新设置已存在的托管属性"RefinableStringXX"并将其映射到" ows_SiteName "
并在你的精炼程序webpart中使用它。其中XX以00开头。
Simply you can re-purpose already existing managed property "RefinableStringXX" and map it to "ows_SiteName" and use it in your refiner webpart. Where XX starts with 00.


这篇关于根据网站标题(O365)过滤搜索结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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