SharePoint 搜索服务适用于文档内容及其元数据(属性),我需要检索与搜索匹配的字段名称及其内容 (SPField)。
我应该向 SelectProperties 对象添加什么字段?或者在哪里可以找到这些信息。
KeywordQuery keywordQuery = new KeywordQuery(SPContext.Current.Site);
keywordQuery.QueryText = queryText;
keywordQuery.ResultsProvider = SearchProvider.Default;
var selecProperties = keywordQuery.SelectProperties;
selecProperties.Add("UniqueId");
selecProperties.Add("FileLeafRef");
selecProperties.Add("ListId");
selecProperties.Add("WebId");
selecProperties.Add("Created");
selecProperties.Add("CheckoutUserOWSUSER");
SearchExecutor searchExecutor = new SearchExecutor();
ResultTableCollection resultTableCollection = searchExecutor.ExecuteQuery(keywordQuery);
ResultTable resultTable = resultTableCollection.Filter("TableType", KnownTableTypes.RelevantResults).FirstOrDefault();
DataTable dataTable = resultTable.Table;