ManagedProperty.Weight property

NOTE: This API is now obsolete.

Gets or sets the weight setting for a managed property.

Namespace:  Microsoft.Office.Server.Search.Administration
Assembly:  Microsoft.Office.Server.Search (in Microsoft.Office.Server.Search.dll)


<ObsoleteAttribute("This property is deprecated. It does not take effect on ranking, please use RankingModel class.")> _
Public Property Weight As Single
Dim instance As ManagedProperty
Dim value As Single

value = instance.Weight

instance.Weight = value
[ObsoleteAttribute("This property is deprecated. It does not take effect on ranking, please use RankingModel class.")]
public float Weight { get; set; }

Property value

Type: System.Single
A double-precision, floating-point number that specifies the weight value for a managed property in the search schema.


The weight setting applies to the relevance framework, and impacts the relative importance of a managed property during the ranking calculation.

For more information about relevance in SharePoint Enterprise Search, see Enterprise Search Relevance Architecture Overview and Improving Relevance.


The following code example changes the weight setting for a managed property. For a step-by-step walkthrough of the code used in this sample, see How to: Change the Weight Setting for a Managed Property.


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.SharePoint;
using Microsoft.Office.Server.Search.Administration;

namespace PropertyWeightSample
    class Program
        static void Main(string[] args)
                if (args.Length != 2)

                Replace <SiteName> with the name of a site using the Shared Service Provider.
                string strURL = "http://<SiteName>";
                Schema sspSchema = new Schema(SearchContext.GetContext(new SPSite(strURL)));
                ManagedPropertyCollection properties = sspSchema.AllManagedProperties;

                string strPropertyName = args[0].ToLower();
                float newWeight = Convert.ToSingle(args[1]);

                if (!properties.Contains(strPropertyName))
                    Console.WriteLine(strPropertyName + " property does not exist.");

                foreach (ManagedProperty property in properties)
                    if (property.Name.ToLower() == strPropertyName)
                        property.Weight = newWeight;
                        Console.WriteLine("Weight value changed for " + strPropertyName + " property.");
                        Console.WriteLine("NAME: " + property.Name + "  WEIGHT: " + property.Weight.ToString());
            catch (Exception ex)

        private static void Usage()
            Console.WriteLine("Change Property Weight");
            Console.WriteLine("Usage: PropertyWeightSample.exe ManagedPropertyName <WeightValue>");
            Console.WriteLine("<WeightValue>: Must be formatted as a float.");

See also


ManagedProperty class

ManagedProperty members

Microsoft.Office.Server.Search.Administration namespace