简体   繁体   English

Kentico SmartSearch和Sharepoint在线

[英]Kentico smartsearch and sharepoint online

I am attempting to set up a custom smart search index for a document library in SharePoint Online. 我正在尝试为SharePoint Online中的文档库设置自定义智能搜索索引。 How do I select all of the files in a document library to be indexed? 如何选择文档库中所有要建立索引的文件?

the ISharepointListService has a GetListItems method, but the ISharePointFileService does not. ISharepointListService具有GetListItems方法,但ISharePointFileService没有。

ex: (DataSet results = listService.GetListItems(listName);) 例如:(数据集结果= listService.GetListItems(listName);)

I need to iterate through each document and index the content and the metadata from the document library columns. 我需要遍历每个文档,并从文档库列中索引内容和元数据。

Any ideas? 有任何想法吗?

Have you considered using the SharePoint Client-Side Object Library (CSOM)? 您是否考虑过使用SharePoint客户端对象库(CSOM)? There's a .NET assembly version, which would be easy to use in a Kentico project. 有一个.NET程序集版本,在Kentico项目中很容易使用。 If you want to index a document library item's metadata, you need to read each list item, as you are with the GetListItems method. 如果要索引文档库项目的元数据,则需要读取每个列表项目,就像使用GetListItems方法一样。 You can also retrieve list items using the CSOM library. 您还可以使用CSOM库检索列表项。 There's a sample, "Retrieve items from a SharePoint list", here: 这里有一个示例“从SharePoint列表中检索项目”:

https://dev.office.com/sharepoint/docs/sp-add-ins/complete-basic-operations-using-sharepoint-client-library-code https://dev.office.com/sharepoint/docs/sp-add-ins/complete-basic-operations-using-sharepoint-client-library-code

However, you also want to index the content. 但是,您还想索引内容。 This means each file needs to be downloaded to a temporary location and its content extracted. 这意味着每个文件都需要下载到一个临时位置并提取其内容。 To get the file path from the CSOM list item, use its FileRef property. 要从CSOM列表项获取文件路径,请使用其FileRef属性。 After downloading the file, the content needs to be extracted. 下载文件后,需要提取内容。 I haven't tried this, but I'd look at using the SearchTextExtractorManager.ExtractData method. 我没有尝试过,但是我将使用SearchTextExtractorManager.ExtractData方法。 If this works, you'll have the metadata from the SharePoint list item, and the content from ExtractData. 如果可行,则将具有SharePoint列表项中的元数据和ExtractData中的内容。 Then, you'd be able to add a document to the SmartSearch (Lucene) index. 然后,您可以将文档添加到SmartSearch(Lucene)索引中。

A much easier solution would be to use a federated search approach. 一个更简单的解决方案是使用联合搜索方法。 Instead of creating a custom SmartSearch index, the search can be executed by calling SharePoint's search API, and the results can be displayed on the same search page next to Kentico results. 无需创建自定义SmartSearch索引,而是可以通过调用SharePoint的搜索API来执行搜索,并且结果可以显示在Kentico结果旁边的同一搜索页上。

https://dev.office.com/sharepoint/docs/general-development/sharepoint-search-rest-api-overview https://dev.office.com/sharepoint/docs/general-development/sharepoint-search-rest-api-overview

Mike 麦克风

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM