You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Azure认知搜索AI索引SharePoint子网站时排除根站点库的问题求助

Azure认知搜索AI索引SharePoint子网站时排除根站点库的问题求助

大家好,我最近在用Azure Search AI(原Azure认知搜索)对接SharePoint的时候碰到了麻烦,想请各位帮忙出出主意。

我的核心需求是:把SharePoint里的内容索引到Azure认知搜索,后续和Azure OpenAI做集成。具体场景是,我有一个名为「Root」的根站点,下面挂着subsite-1、subsite-2、subsite-3等多个子站点——我只想索引这些子站点里的文档库,而且要把每个子站点库的自定义列也同步到索引里。但根站点本身的文档库没有这些自定义列,我完全不想把它们纳入索引范围。

当前的数据源配置

我一开始的数据源配置是这样的:

{
  "name": "prod-sharepoint-datasource",
  "type": "sharepoint",
  "credentials": {
    "connectionString": "SharePointOnlineEndpoint=https://xxx.sharepoint.com/sites/Root/;ApplicationId=xxx;ApplicationSecret=xxx"
  },
  "container": {
    "name": "useQuery",
    "query": "includeLibrariesInSite=https://xxx.sharepoint.com/sites/Root;additionalColumns=MyCustomColumn,MyCustomColumn2,MyCustomColumn3"
  }
}

我尝试过的排除方法(未生效)

我试过用excludeLibrary属性来排除根站点的库,但没达到预期效果,修改后的数据源配置如下:

{
  "name": "prod-sharepoint-datasource",
  "type": "sharepoint",
  "credentials": {
    "connectionString": "SharePointOnlineEndpoint=https://xxx.sharepoint.com/sites/Root/;ApplicationId=xxx;ApplicationSecret=xxx"
  },
  "container": {
    "name": "useQuery",
    "query": "includeLibrariesInSite=https://xxx.sharepoint.com/sites/Root;additionalColumns=MyCustomColumn,MyCustomColumn2,MyCustomColumn3;excludeLibrary=https://xxx.sharepoint.com/sites/Root/default.aspx;excludeLibrary=https://xxx.sharepoint.com/sites/Root/Library1.aspx;excludeLibrary=https://xxx.sharepoint.com/sites/Root/Library2.aspx;excludeLibrary=https://xxx.sharepoint.com/sites/Root/Library3.aspx"
  }
}

我的索引和索引器配置

下面是我当前用的索引和索引器配置,供大家参考:

索引配置

{
  "name" : "prod-sharepoint-indexes",
  "fields": [
    { "name": "column1", "type": "Edm.String", "searchable": true, "filterable": false, "sortable": false, "facetable": false },
    { "name": "column2", "type": "Edm.String", "searchable": true, "filterable": false, "sortable": false, "facetable": false },
    { "name": "column3", "type": "Edm.String", "searchable": true, "filterable": false, "sortable": false, "facetable": false },
    { "name": "content", "type": "Edm.String", "searchable": true, "filterable": false, "sortable": false, "facetable": false },
    { "name": "id", "type": "Edm.String", "key": true, "searchable": false },
    { "name": "metadata_spo_item_name", "type": "Edm.String", "key": false, "searchable": true, "filterable": false, "sortable": false, "facetable": false },
    { "name": "metadata_spo_item_path", "type": "Edm.String", "key": false, "searchable": false, "filterable": false, "sortable": false, "facetable": false },
    { "name": "metadata_spo_item_weburi", "type": "Edm.String", "key": false, "searchable": false, "filterable": false, "sortable": false, "facetable": false },
    { "name": "metadata_spo_item_content_type", "type": "Edm.String", "key": false, "searchable": false, "filterable": true, "sortable": false, "facetable": true },
    { "name": "metadata_spo_item_last_modified", "type": "Edm.DateTimeOffset", "key": false, "searchable": false, "filterable": false, "sortable": true, "facetable": false },
    { "name": "metadata_spo_item_size", "type": "Edm.Int64", "key": false, "searchable": false, "filterable": false, "sortable": false, "facetable": false },
    { "name": "content", "type": "Edm.String", "searchable": true, "filterable": false, "sortable": false, "facetable": false }
  ]
}

索引器配置

{
  "name" : "prod-sharepoint-indexer",
  "dataSourceName" : "prod-sharepoint-datasource",
  "targetIndexName" : "prod-sharepoint-indexes",
  "parameters": {
    "batchSize": null,
    "maxFailedItems": null,
    "maxFailedItemsPerBatch": null,
    "base64EncodeKeys": null,
    "configuration": {
      "indexedFileNameExtensions" : ".pdf, .docx, .msg, .xlsx, .eml, .ppt, .doc",
      "excludedFileNameExtensions" : ".png, .jpg",
      "dataToExtract": "contentAndMetadata"
    }
  },
  "schedule" : { },
  "fieldMappings" : [
    {
      "sourceFieldName" : "metadata_spo_site_library_item_id",
      "targetFieldName" : "id",
      "mappingFunction" : {
        "name" : "base64Encode"
      }
    }
  ]
}

现在我想请教各位:有没有什么方法能正确排除根站点的所有文档库,或者直接跳过整个根站点,只索引它下属子站点的库?如果有相关经验或者思路,麻烦不吝赐教,非常感谢!

备注:内容来源于stack exchange,提问作者Hassaan ch

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 07:53:07