"Content" 为 Azure 搜索索引 blob 内容时太大

"Content" too large when indexing blob content for Azure Search

我按照本文所述为 Azure 设置了 blob 索引和全文搜索:Indexing Documents in Azure Blob Storage with Azure Search

我的一些文档在索引器中失败,抛出返回以下错误:

Field 'content' contains a term that is too large to process. The max length for UTF-8 encoded terms is 32766 bytes. The most likely cause of this error is that filtering, sorting, and/or faceting are enabled on this field, which causes the entire field value to be indexed as a single term. Please avoid the use of these options for large fields.

产生此错误的特定 pdf 文件大小为 3.68 MB,包含各种内容(文本、表格、图像等)。

索引和索引器完全按照那篇文章中的描述进行设置,但增加了一些文件类型限制。

索引:

{
    "name": "my-index",
    "fields": [{
        "name": "id",
        "type": "Edm.String",
        "key": true,
        "searchable": false
    }, {
        "name": "content",
        "type": "Edm.String",
        "searchable": true
    }]
}

索引器:

{
    "name": "my-indexer",
    "dataSourceName": "my-data-source",
    "targetIndexName": "my-index",
    "schedule": { 
        "interval": "PT2H"
    },
    "parameters": {
        "maxFailedItems": 10,
        "configuration": {
            "indexedFileNameExtensions": ".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.html,.xml,.eml,.msg,.txt,.text"
        }
    }
}

我尝试搜索他们的文档和其他一些相关文章,但我找不到任何信息。我猜这是因为此功能仍处于预览阶段。

搜索索引中单个字词的大小有限制 - 它也恰好是 32KB。如果搜索索引中的 content 字段标记为 filterablefacetablesortable,那么您将达到此限制(无论该字段是否标记为可搜索或不是)。通常对于大型可搜索内容,您希望启用 searchable,有时 retrievable 但不启用其余内容。这样你就不会从索引端达到内容长度的限制。

请参阅 了解更多上下文。