sharepoint 搜索_Sharepoint搜索中的自定义排名模型

sharepoint 搜索

How do you keep your CDs sorted to quickly find what your looking for? In alphabetical order, based on popularity, genre or just a nice organized chaos?  A search in Sharepoint 2010 usually lists the search results after the built-in relevancy order. According to Microsoft, it's based on BM25 . If it's true or what it really means is hard to know. Since we don't want to blindly rely on Microsoft, we have tested to create our own sort order. The advantage is that we know how it is supposed to act. We have chosen to weight very high if the search keyword is in the name of the document, and then weighted our properties based on what we feel is most relevant. We're evaluating this right now but so far we are pretty pleased.

如何保持CD排序以快速找到所需内容? 以字母顺序排列,根据受欢迎程度,体裁还是只是一个有组织的混乱? Sharepoint 2010中的搜索通常会按照内置的相关性顺序列出搜索结果。 根据微软的说法,它是基于BM25的。 如果是真的还是真的意味着很难知道。 由于我们不想盲目地依赖Microsoft,因此我们进行了测试以创建自己的排序顺序。 好处是我们知道它应该如何工作。 如果搜索关键字位于文档的名称中,则我们选择了非常高的权重,然后根据我们认为最相关的属性对属性进行加权。 我们正在对此进行评估,但到目前为止,我们感到非常满意。

It was hard to find any good description of how to go about building custom order of relevance, but I hope the following description will still be pretty accurate:

很难找到关于如何建立自定义相关性顺序的任何好的描述,但是我希望以下描述仍然非常准确:

In SharePoint 2007 there was a nice tool for weight our search results according to your properties. The tool is available here: http://searchrelevancy.codeplex.com/

在SharePoint 2007中,有一个不错的工具可以根据您的属性对搜索结果进行加权。 该工具位于此处: http : //searchrelevancy.codeplex.com/

In 2010, you have to fix this yourself. What you do is creating an XML with instructions on how the search should be weighted. With the help of the XML you then create a custom ranking model that is added to Sharepoint as possible choices. One can then choose whether to use any of the Sharepoint default ranking models or our own.

在2010年,您必须自己解决此问题。 您要做的是创建一个XML,其中包含有关如何加权搜索的说明。 然后,借助XML,您可以创建一个自定义的排名模型,该模型将作为可能的选择添加到Sharepoint。 然后,可以选择使用任何Sharepoint默认排名模型还是使用我们自己的模型。

How do you do that? Well, here is a template on how the xml should look like. It looks like this:

你是怎样做的? 好吧,这是一个有关xml外观的模板。 看起来像这样:

<rankingModel name=”string” id=”GUID” description=”string” xmlns=”http://schemas.microsoft.com/office/2009/rankingModel“>
  <queryDependentFeatures>
    <queryDependentFeature pid=”PID” name=”string” weight=”weightValue” lengthNormalization=”lengthNormalizationSetting” />
  </queryDependentFeatures>
  <queryIndependentFeatures>
    <categoryFeature pid=”PID” default=”defaultValue” name=”string”>
      <category value=”categoryValue” name=”string” weight=”weightValue” />
    </categoryFeature>
    <languageFeature pid=”PID” name=”string” default=”defaultValue” weight=”weightValue” />
    <queryIndependentFeature pid=”PID” name=”string” default=”defaultValue”  weight=”weightValue”>
      <transformRational k=”value” />
      <transformInvRational k=”value” />
      <transformLinear max=”maxValue” />
    </queryIndependentFeature>
  </queryIndependentFeatures>
</rankingModel>

The following link describes the different elements in the XML:  http://msdn.microsoft.com/en-us/library/ee558793 (office.14). aspx

以下链接描述了XML中的不同元素: http : //msdn.microsoft.com/zh-cn/library/ee558793 (office.14)。 aspx

I begin with the element RankingModel where I must state the name and id. The description is optional. In queryDependentFeatures I can add my managed properties. I will add a queryDependentFeature element, but do not understand what they mean by pid. I finally found out how to get the pid. This is done with the following PowerShell command:

我从元素RankModel开始,其中必须说明名称和ID。 该描述是可选的。 在queryDependentFeatures中,我可以添加托管属性。 我将添加一个queryDependentFeature元素,但不了解pid的含义。 我终于找到了如何获取pid的方法。 这是通过以下PowerShell命令完成的:

Get-SPEnterpriseSearchServiceApplication | Get-SPEnterpriseSearchMetadataManagedProperty

However, I am curious about what a queryIndependentFeature is. It turns out when you look at the example that it is about the weighting of other things than manage properties.Such as where the document is placed in the hierarchy or how many people opened it. I’ve found these four names on a queryIndependentFeature: DistanceFromAuthority, URLdepth, DocumentPopularity, DocumentUnpopularity. I weighted DocumentPopularity. I have no idea what transformsRational, transformInvRational and transformLinear are, but I cut out from an example and they used transformsRational so I did that to.

但是,我对queryIndependentFeature是什么感到好奇。 当您查看该示例时,事实证明,它与管理属性以外的其他事情有关,例如文档在层次结构中的位置或打开它的人数。 我在queryIndependentFeature上找到了这四个名称:DistanceFromAuthority,URLdepth,DocumentPopularity,DocumentUnpopularity。 我加权了DocumentPopularity。 我不知道transformsRational,transformInvRational和transformLinear是什么,但是我从一个示例中切出,他们使用了transformsRational,所以我做到了。

The XML becomes something like this in the end:

XML最终变成这样的东西:

<?xml version="1.0" encoding="utf-8"?>

<rankingModel name="KM_Ranking" id="0f054f54-6a42-4a9b-abcb-123456778" description=”KMs viktning på managed property” xmlns=”http://schemas.microsoft.com/office/2009/rankingModel“>
  <queryDependentFeatures>
    <queryDependentFeature pid=”56" name=”Filename” weight=”75"  lengthNormalization=”75” />
    <queryDependentFeature pid=”11" name=”Land” weight=”70" lengthNormalization=”70"/>
    <queryDependentFeature pid=”2" name=”Län” weight=”70" lengthNormalization=”70"/>
    <queryDependentFeature pid=”3" name=”Kommun” weight=”60" lengthNormalization=”60"/>
    <queryDependentFeature pid=”4" name=”Stad” weight=”55" lengthNormalization=”55"/>
    <queryDependentFeature pid=”5" name=”Stadsdel” weight=”50" lengthNormalization=”50" />
    <queryDependentFeature pid=”6" name=”Församling” weight=”45" lengthNormalization=”45"/>
    <queryDependentFeature pid=”7" name=”Postnummer” weight=”40"lengthNormalization=”40"/>
    <queryDependentFeature pid=”8" name=”Created” weight=”30¿ lengthNormalization=”30"/>
   <queryDependentFeature pid=”1" name=”Body”  weight=”20" lengthNormalization=”20" /> 

</queryDependentFeatures>
  <queryIndependentFeatures>

    <queryIndependentFeature name=”DocumentPopularity”
                                 pid=”306" default=”0" weight=”80">
      <transformRational k=”1.2170868558"/>
    </queryIndependentFeature>

  </queryIndependentFeatures>
</rankingModel>

Edit: It's importent to include the DependentFeature “body” if you want search hits on content (text in document).

编辑:如果要在内容(文档中的文本)中搜索匹配,包含DependentFeature“ body”很重要。

To install this I run the following PowerShell script:

要安装此程序,我运行以下PowerShell脚本:

Get-SPEnterpriseSearchServiceApplication | New-SPEnterpriseSearchRankingModel

When you come this far, it's always nice to try around with the ranking models. Here are some PowerShell commands that can be useful to know:

当您走到这一步时,尝试使用排名模型总是很高兴的。 以下是一些有助于了解的PowerShell命令:

Delete a ranking model:

删除排名模型:

$rankingModel = Get-SPEnterpriseSearchServiceApplication -Identity “Search Service” | Get-SPEnterpriseSearchRankingModel $rankingModel | Remove-SPEnterpriseSearchRankingModel
Get-SPEnterpriseSearchServiceApplication -identity “Search Service Application Name” | get-SPEnterpriseSearchRankingModel 

If you want to see the XML, try this SQL-script in the database:

如果要查看XML,请在数据库中尝试以下SQL脚本:

 
  SELECT TOP 1000 [ModelId]
      ,[IsDefault]
      ,[ModelXml]
  FROM [Servernamn_Search_AdminDB].[dbo].[MSSRankingModels]

Can I test my Custom Ranking Model to see if it works? Well, go to the search results page and add the parameter rm in the url with the guid to your ranking model as value. Should look something like this: http://site/sitepages/searchresult.aspx?rm=0f054f54-6a42-4a9b-abcb-12345678

我可以测试“自定义排名模型”以查看是否有效吗? 好吧,转到搜索结果页面,然后在URL中添加参数rm,并在您的排名模型中将guid作为值。 应该看起来像这样: http://site/sitepages/searchresult.aspx?rm = 0f054f54-6a42-4a9b-abcb-12345678

Then it's time to install it so that it works for the users. According to this blog: http://calvisblog.wordpress.com/2010/06/21/custom-ranking-models-with-sharepoint-2010-background-value-and-administrative-overview/

然后是时候安装它了,它可以为用户使用。 根据此博客: http : //calvisblog.wordpress.com/2010/06/21/custom-ranking-models-with-sharepoint-2010-background-value-and-administrative-overview/

there are several options. I chose the first one. What you do is export the search results web part, change the ranking settings, and import it again. How do I go about:

有几种选择。 我选择了第一个。 您要做的是导出搜索结果Web部件,更改排名设置,然后再次导入。 我该怎么做:

Go to the search results page and choose to export the search core results webpart.

转到搜索结果页面,然后选择导出搜索核心结果Web部件。

I download the file and open it in SharePoint Designer. I search for DefaultRankingModelID. I put the quid in the tag, so that it becomes:

我下载文件并在SharePoint Designer中打开它。 我搜索DefaultRankingModelID。 我将quid放入标签中,因此它变为:

<property name=”DefaultRankingModelID” type=”string”>0f054f54-6a42-4a9b-abcb-1234567</property>

Now it is transferred to Sharepoint, but not shown in the layout. Therefore, we choose Edit –> Insert –> web part again. There should be a new folder called something like “Imported Web Parts” where it supposed to be. Is it not, then try importing it again.

现在,它已传输到Sharepoint,但未在布局中显示。 因此,我们再次选择编辑–>插入–> Web部件。 应该有一个新文件夹,名为“ Imported Web Parts”。 是不是,然后尝试再次导入。

Good Luck!

祝好运!

Note: This article is based on one of my post from my blog: http://sharepointkaos.wordpress.com/2011/01/13/custom-ranking-model/

注意:本文基于我的博客文章之一: http : //sharepointkaos.wordpress.com/2011/01/13/custom-ranking-model/

翻译自: https://www.experts-exchange.com/articles/10741/Custom-Ranking-Model-in-Sharepoint-search.html

sharepoint 搜索

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值