Share via


Ranking 类 (Microsoft.Office.Server.Search.Administration)

Provides an entry point to adjust the settings used for query-independent rank computation for calculating the relevance of 企业级搜索 results.

命名空间: Microsoft.Office.Server.Search.Administration
程序集: Microsoft.Office.Server.Search (在 microsoft.office.server.search.dll 中)

语法

声明
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
Public NotInheritable Class Ranking
用法
Dim instance As Ranking
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
public sealed class Ranking

备注

Use the Ranking constructor of the Ranking class to initialize an object that provides an entry point to the Relevance object model.

For more information about search relevance, see 企业级搜索相关性体系结构概述.

示例

The following code example writes out the ranking parameter names and built-in values to the console window.

Prerequisites

Ensure a Shared Services Provider is already created.

Project References

Add the following Project References in your console application code project before running this sample:

  • Microsoft.SharePoint

  • Microsoft.Office.Server

  • Microsoft.Office.Server.Search

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Server.Search.Administration;
using Microsoft.SharePoint;
namespace RankingParameterSample
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                /*
                Replace <SiteName> with the name of a site 
                using the Shared Services Provider.
                */
                string strURL = "http://<SiteName>";
                SearchContext context;
                using (SPSite site = new SPSite("http://yourSiteName"))
                {
                    context = SearchContext.GetContext(site);
                }
                Ranking sRanking = new Ranking(context);
                RankParamCollection rankParams = sRanking.RankingParameters;

                foreach (RankingParameter rankParam in rankParams)
                {
                    Console.WriteLine("NAME: " + rankParam.Name + "...VALUE: " + rankParam.Value);
                }
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
    }
}

继承层次结构

System.Object
  Microsoft.Office.Server.Search.Administration.Ranking

线程安全性

此类型的任何公共静态( Visual Basic 中共享)成员是线程安全的。不保证任何实例成员都是线程安全的。

另请参阅

参考

Ranking 成员
Microsoft.Office.Server.Search.Administration 命名空间