0

我编写了一个 .net sdk 来创建索引和索引器。我如何根据扩展名从索引中排除某些文件。我无法找到执行相同操作的示例/示例

    Indexer indexer = new Indexer()
        {
            Name = indexerName,
            DataSourceName = userDocsDataSource,
            TargetIndexName = indexName,
            Schedule = new IndexingSchedule()
            {
                Interval = System.TimeSpan.FromMinutes(Convert.ToDouble(ConfigurationManager.AppSettings["indexrefreshtime"]))
            }
        };

请告诉我。谢谢

4

1 回答 1

1

请尝试以下操作:

    Indexer indexer = new Indexer()
    {
        Name = indexerName,
        DataSourceName = userDocsDataSource,
        TargetIndexName = indexName,
        Parameters = new IndexingParameters(),
        Schedule = new IndexingSchedule()
        {
            Interval = System.TimeSpan.FromMinutes(Convert.ToDouble(ConfigurationManager.AppSettings["indexrefreshtime"]))
        }
    };
    indexer.Parameters.ExcludeFileNameExtensions(".pdf", ".doc");

您可以在此处阅读有关客户端 SDK 的文档:https ://docs.microsoft.com/en-us/dotnet/api/overview/azure/search/client?view=azure-dotnet 。

于 2017-09-11T11:07:25.797 回答