QualityComponentCollection Interface

Represents a quality component collection as a list of quality 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 QualityComponentCollection _
    Inherits IEnumerable(Of QualityComponent), IEnumerable
'Usage
Dim instance As QualityComponentCollection
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public interface QualityComponentCollection : IEnumerable<QualityComponent>, 
    IEnumerable

Remarks

Quality components are associated with a RankProfile object and are used to influence the ranking of search results. Quality components are a weighted set of numerical and sortable managed properties which together represents the quality ranking contribution for the associated rank profile. Managed properties that are part of a QualityComponent typically describe a quality attribute of a document like [docrank] which is a system generated managed property indicating the document importance of a document based on anchor and link analysis.

Examples

This sample shows how to add a new quality component to the default rank profile

            using System;
            using Microsoft.SharePoint.Search.Extended.Administration;
            using Microsoft.SharePoint.Search.Extended.Administration.Schema;
            
            namespace QualityComponentSample
            {
                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"];
            
                            //Create a new managed property to create a quality component for.
                            ManagedProperty managedProperty = schema.AllManagedProperties.Create("mymp", "mymp description", ManagedType.Integer);
                            //Set the sortable type of the new managed property to sortable enabled.
                            //It is only possible to create quality components of managed properties 
                            //of numeric managed type and sortable type == SortableEnabled.
                            managedProperty.SortableType = ManagedPropertySortableType.SortableEnabled;
                            managedProperty.Update();
            
                            QualityComponentCollection qualityComponents = rankProfile.GetQualityComponents();
                            qualityComponents.Create(managedProperty, 100); //The second argument is the weight 
            
                            //Print all quality components for the RankProfile named default.
                            //This will also list the new quality component if it was successfully created.
                            foreach (var component in qualityComponents)
                            {
                                Console.WriteLine("managed property: " + component.ManagedPropertyReference.Name + " weight: " + component.Weight);
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                        }
                    }
                }
            }
             

See Also

Reference

QualityComponentCollection Members

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