RankParamCollection 类 (Microsoft.Office.Server.Search.Administration)
Represents a collection of RankingParameter objects.
命名空间: Microsoft.Office.Server.Search.Administration
程序集: Microsoft.Office.Server.Search (在 microsoft.office.server.search.dll 中)
语法
声明
<DefaultMemberAttribute("Item")> _
<SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel:=True)> _
Public NotInheritable Class RankParamCollection
Implements IEnumerable
用法
Dim instance As RankParamCollection
[DefaultMemberAttribute("Item")]
[SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel=true)]
public sealed class RankParamCollection : IEnumerable
备注
Use the RankingParameters property of the Ranking class to get the collection of ranking parameters for a Shared Service Provider.
Use an indexer to return a single ranking parameter from the RankParamCollection object. For example, assuming the collection is assigned to a variable named rankingParams, use rankingParams[index] in Microsoft Visual C# or rankingParams(index) in Microsoft Visual Basic, where index is the index number of the ranking parameter in the collection, or a string containing the name of the ranking parameter.
备注
You cannot add new ranking parameters, or remove or change the names of existing parameters; you can modify only the ranking parameter's value.
示例
The following code example writes out the ranking parameter names and built-in values to the console window.
Prerequisites
Ensure a Shared Service 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 Service Provider.
string strURL = "http://<SiteName>";
Ranking searchRanking = new Ranking(SearchContext.GetContext(new SPSite(strURL)));
RankParamCollection rankParams = searchRanking.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.RankParamCollection
线程安全性
此类型的任何公共静态(在 Visual Basic 中共享)成员是线程安全的。不保证任何实例成员都是线程安全的。
另请参阅
参考
RankParamCollection 成员
Microsoft.Office.Server.Search.Administration 命名空间