CrawledProperty 类 (Microsoft.Office.Server.Search.Administration)

Represents a crawled property in the 企业级搜索 metadata property schema.

命名空间: Microsoft.Office.Server.Search.Administration
程序集: Microsoft.Office.Server.Search (在 microsoft.office.server.search.dll 中)

语法

声明
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
Public NotInheritable Class CrawledProperty
用法
Dim instance As CrawledProperty
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
public sealed class CrawledProperty

备注

Crawled properties are the set of properties discovered by the 企业级搜索 index service component when crawling content. For more information about crawled properties, see 管理元数据.

Crawled properties are grouped by category, based on the protocol handler that is used. Use the GetAllCrawledProperties method of the Category class to get the collection of CrawledProperty objects representing the crawled properties for a specific category.

Crawled properties are mapped to managed properties to make them available for the 企业级搜索 user experience. Use the GetMappedCrawledProperties method of the ManagedProperty class to get the collection of CrawledProperty objects that represent the crawled properties mapped to specific managed property.

示例

The following code example writes out a list of crawled properties, which are mapped to a specific managed property, to the console window. For a complete, step-by-step walkthrough of this sample code, see 如何:检索映射到托管属性的已爬网属性.

Prerequisites

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

namespace CrawledPropertiesSample
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                //Replace <SiteName> with the name of a site that uses the Shared Service Provider.
                string strURL = "http://<SiteName>";
                Schema sspSchema = new Schema(SearchContext.GetContext(new SPSite(strURL)));
                ManagedPropertyCollection props = sspSchema.AllManagedProperties;
                //Replace <ManagedPropertyName> with the name of a managed property.
                ManagedProperty mProp = props["<ManagedPropertyName>"];
                foreach (CrawledProperty cProp in mProp.GetMappedCrawledProperties(mProp.GetMappings().Count))
                {
                      Console.WriteLine(cProp.Name);
                      Console.WriteLine(cProp.Propset);
                 }
                 return;
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
    }
}

继承层次结构

System.Object
  Microsoft.Office.Server.Search.Administration.CrawledProperty

线程安全性

此类型的任何公共静态( Visual Basic 中共享)成员是线程安全的。不保证任何实例成员都是线程安全的。

另请参阅

参考

CrawledProperty 成员
Microsoft.Office.Server.Search.Administration 命名空间