ManagedPropertyBoostCollection Interface
Represents a ManagedPropertyBoostCollection as a list of managed property boost components.
Namespace: Microsoft.SharePoint.Search.Extended.Administration.Schema
Assembly: Microsoft.SharePoint.Search.Extended.Administration (in Microsoft.SharePoint.Search.Extended.Administration.dll)
Syntax
'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Interface ManagedPropertyBoostCollection _
Inherits IEnumerable(Of ManagedPropertyBoostComponent), IEnumerable
'Usage
Dim instance As ManagedPropertyBoostCollection
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public interface ManagedPropertyBoostCollection : IEnumerable<ManagedPropertyBoostComponent>,
IEnumerable
Remarks
Managed property boosts are used to influence the ranking of search results by creating boosts that are triggered based on the contents of a managed property. For example, assume that there is a managed property called [Language] that specifies the language for a document. Some valid values for [Language] would be the strings "English", "Norwegian" and "German". A managed property boost could then be created to boost the ranking for documents where the managed property [Language] contained the string "English". This managed property boost would then be associated with a rank profile. When the rank profile is used through search, English documents would then be given a rank boost.
Examples
This sample shows how to boost English documents with the default rank profile.
using System;
using Microsoft.SharePoint.Search.Extended.Administration;
using Microsoft.SharePoint.Search.Extended.Administration.Schema;
namespace ManagedPropertyBoostComponentSample
{
class Program
{
static void Main(string[] args)
{
try
{
SchemaContext schemaContext = new SchemaContext();
Schema schema = schemaContext.Schema;
//Fetch the rank profile named 'default' which is the default rank profile.
RankProfile rankProfile = schema.AllRankProfiles["default"];
//Fetch the managed property named 'language'. This managed property exists
//by default and is populated with the language of documents, for example: 'en'
//for English documents.
ManagedProperty managedProperty = schema.AllManagedProperties["language"];
ManagedPropertyBoostCollection managedPropertyBoosts = rankProfile.GetManagedPropertyBoosts();
//The format of the string is 'matchString, boostValue': in this case 'en, 100'.
managedPropertyBoosts.Create(managedProperty, "en, 100");
//Print all managed property boost components for the rank profile named 'default'.
//This will also list the new managed property boost component if it was successfully created.
foreach (var component in managedPropertyBoosts)
{
Console.WriteLine("managed property: " + component.ManagedPropertyReference.Name + " boostValue: " + component.BoostValue);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
}
See Also
Reference
ManagedPropertyBoostCollection Members
Microsoft.SharePoint.Search.Extended.Administration.Schema Namespace