Export (0) Print
Expand All

FullTextIndexRankCollection Interface

SharePoint 2010

Represents a full text index rank collection.

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

[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public interface FullTextIndexRankCollection : IEnumerable<FullTextIndexRankComponent>, 
	IEnumerable

A [FullTextIndexRankCollection] is associated with a rank profile and represents relevance settings for a collection of FullTextIndexRankComponent objects.

This sample shows how to boost the proximity weight for the default full text index. Increasing the proximity weight will boost the ranking of documents that matches multi term queries where the terms appear near each other in the text.


            using System;
            using Microsoft.SharePoint.Search.Extended.Administration;
            using Microsoft.SharePoint.Search.Extended.Administration.Schema;
            
            namespace FullTextIndexRankComponentSample
            {
                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 full text index ranks and iterate over the collection to find the component to update.
                            //The default full text index is by default called: 'content'.
                            FullTextIndexRankCollection fullTextIndexRanks = rankProfile.GetFullTextIndexRanks();
                            foreach (var rankComponent in fullTextIndexRanks)
                            {
                                if (rankComponent.FullTextIndexReference.Name.Equals("content"))
                                {
                                    int currentProximityWeight = rankComponent.ProximityWeight;
                                    Console.WriteLine("Current proximity weight: " + currentProximityWeight + " of rank component: " + rankComponent.FullTextIndexReference.Name);
                                    rankComponent.ProximityWeight += 10;
                                    rankComponent.Update();
                                    Console.WriteLine("New proximity weight: " + rankComponent.ProximityWeight + " of rank component: " + rankComponent.FullTextIndexReference.Name);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                        }
                    }
                }
            }
            
Show:
© 2014 Microsoft