SharePoint 2016爬网属性 [英] SharePoint 2016 Getting Crawled Property

查看:98
本文介绍了SharePoint 2016爬网属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在研究SharePoint 2016项目,该项目具有基于模块化的搜索驱动的体系结构,可以通过Web和网站功能轻松安装.
 
几天以来,我一直在努力寻找可爬网的属性.安装后,每个模块都会进行注册并添加虚拟数据以显示在搜索属性中.当我在完全爬网后检查爬网属性时,我可以在列表中看到我的属性(中央管理 模式页面).但是,当我尝试通过代码获取抓取的属性时,结果为null.您对这种情况有任何想法吗?

我的代码;

字符串   propertyName =  SearchProxy   proxy =    SearchProxy var   application = proxy.GetSearchServiceApplication();

 

Schema   sspSchema =    Schema  

类别   categorySP = sspSchema.AllCategories [  

var   cp = categorySP.QueryCrawledProperties(propertyName, 1,  Guid true //count cp为零

 

var   allSPProperties = categorySP.GetAllCrawledProperties().ToList();

//this集不包含我爬行的peoperty

 

var   customProperty = allSPProperties.FirstOrDefault(p => p.Name.Equals(propertyName, StringComparison .InvariantCultureIgnoreCase));

//这也是空的

解决方案

您能否尝试以下代码,似乎您使用的是自定义的包装"代码.

使用(SPSite网站=新的SPSite("http://sp:12001"))
            {
                SPServiceContext serviceContext = SPServiceContext.GetContext(site);
                SearchServiceApplicationProxy searchProxy =
                serviceContext.GetDefaultProxy(typeof(SearchServiceApplicationProxy))作为SearchServiceApplicationProxy;
                如果(searchProxy!= null)
                {
                    SearchServiceApplicationInfo searchServiceAppInfo = searchProxy.GetSearchServiceApplicationInfo();
                    SearchServiceApplication searchServiceApp = SearchService.Service.SearchApplications.GetValue< SearchServiceApplication>(searchServiceAppInfo.SearchServiceApplicationId);
                    架构searchSchema = new Schema(searchServiceApp);
                    var property = searchSchema.GetCrawledProperty(new Guid("00130329-0000-0130-c000-000000131346"),"ows_Choice");

                }
                Console.WriteLine(完成");
                Console.ReadKey();
            } 

您可以得到 向导 来自属性.


I am working on a SharePoint 2016 project which has modular based search driven architecture and will be installed easily via Web and Site features.
 
I've been struggling since a couple days with crawled properties. After installation, each modules registers itself and add dummy data to show up in search properties. When i checked crawled property after full crawl i can see mine in the list (central administration schema page). But when i try to get the crawled property by code, result is null. Do you have any idea about this situation?

my code;

 

string propertyName = "ows_WatchCount";

SearchProxy proxy = new SearchProxy(site);

var application = proxy.GetSearchServiceApplication();

 

Schema sspSchema = new Schema(application);

 

Category categorySP = sspSchema.AllCategories["SharePoint"];

 

var cp = categorySP.QueryCrawledProperties(propertyName, 1, Guid.Empty, nulltrue);

//count of cp is zero

 

var allSPProperties = categorySP.GetAllCrawledProperties().ToList();

//this set does not contain my crawled peoperty

 

var customProperty = allSPProperties.FirstOrDefault(p => p.Name.Equals(propertyName, StringComparison.InvariantCultureIgnoreCase));

// this is also null

解决方案

Hi,

Could you try with below code, seems you’re using custom ‘wrapped’ code.

using (SPSite site = new SPSite("http://sp:12001"))
            {
                SPServiceContext serviceContext = SPServiceContext.GetContext(site);
                SearchServiceApplicationProxy searchProxy =
                serviceContext.GetDefaultProxy(typeof(SearchServiceApplicationProxy)) as SearchServiceApplicationProxy;
                if (searchProxy != null)
                {
                    SearchServiceApplicationInfo searchServiceAppInfo = searchProxy.GetSearchServiceApplicationInfo();
                    SearchServiceApplication searchServiceApp = SearchService.Service.SearchApplications.GetValue<SearchServiceApplication>(searchServiceAppInfo.SearchServiceApplicationId);
                    Schema searchSchema = new Schema(searchServiceApp);
                    var property = searchSchema.GetCrawledProperty(new Guid("00130329-0000-0130-c000-000000131346"), "ows_Choice");

                }
                Console.WriteLine("done");
                Console.ReadKey();
            }

You could get the Guid propset from property.


 

Best Regards,

Lee


这篇关于SharePoint 2016爬网属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆