Condividi tramite


RankProfile Interface

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)

Syntax

'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Interface RankProfile
'Usage
Dim instance As RankProfile
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public interface RankProfile

Remarks

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

Examples

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)
                    {
                        try
                        {
                            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;
                            rankProfile.Update();
            
                            Console.WriteLine("Default freshness weight for rank profile: " + rankProfile.Name +
                                              " was " + freshnessWeight + ", now updated to " + rankProfile.FreshnessWeight);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                        }
                    }
                }
            }
             

See Also

Reference

RankProfile Members

Microsoft.SharePoint.Search.Extended.Administration.Schema Namespace

Other Resources

RankProfile