RankProfile Interface

RankProfile Interface

SharePoint 2010

Represents a rank profile. Rank profiles contains settings for tuning the relevance of the search system.

Namespace:  Microsoft.SharePoint.Search.Extended.Administration.Schema
Assembly:  Microsoft.SharePoint.Search.Extended.Administration (in Microsoft.SharePoint.Search.Extended.Administration.dll)

[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public interface RankProfile

A rank profile contains a number of settings to control the ranking of search results.

This sample shows how to add a new rank profile to the index schema. The created rank profile is also updated to add more contribution to freshness ranking.

            using System;
            using Microsoft.SharePoint.Search.Extended.Administration;
            using Microsoft.SharePoint.Search.Extended.Administration.Schema;
            namespace RankProfileSample
                class Program
                    static void Main(string[] args)
                            SchemaContext schemaContext = new SchemaContext();
                            Schema schema = schemaContext.Schema;
                            //Create a new rank profile named 'freshness'
                            RankProfile rankProfile = schema.AllRankProfiles.Create("freshness");
                            //By default the new rank profile will inherit the settings from the default rank profile.
                            //We want this rank profile to give more boost to new documents
                            int freshnessWeight = rankProfile.FreshnessWeight;
                            rankProfile.FreshnessWeight += 50;
                            Console.WriteLine("Default freshness weight for rank profile: " + rankProfile.Name +
                                              " was " + freshnessWeight + ", now updated to " + rankProfile.FreshnessWeight);
                        catch (Exception ex)
© 2015 Microsoft