Bug in
Azure Search

May 12


Sitefinity supports Azure Search which is massively saleable. But there is a blocking issue where you can not index a site that has more than 1000 items\documents. The good news is that Sitefinity are aware of this. They have a fix for you to use and have the issue logged so as to be addressed and fixed in the product.

If you read the Azure Search documentation you will find a restriction of only publishing 1000 items to a index at once. This means that if you have large amounts of data to push into your Azure Search index then you need to batch them into groups.

Currently, 9.0.6013.0, Sitefinity doesn't take this into account and if, like me, you try to index\re-index a search with more than 1000 items, the process will error. To get around this I had to create a special function that basically opened each of my items and republished them in batches. (A better solution to come at the end of this post.) This works because as you called the 'SaveChanges()' method Sitefinity would then send that batch of changes to the search index.

I contacted Sitefinity and the good news is they have logged this as an issue and will look to get this addressed. They also provided me with a much better solution to deal with the indexing problem.

Below is a class you can use to implement a batching process of items to the search index. I have set a batch limit of 500 out of choice but you could push this to 1000 if you wish.

using Telerik.Sitefinity.Utilities;
MyAzureSearchService : AzureSearchService
    public override void UpdateIndex(string indexName, IEnumerable<IDocument> documents)
        var batches = documentsOnBatchesOf(500);
        foreach (var batch in batches)
            base.UpdateIndex(indexName, batch);

If you are getting failed re-indexing issues when using Azure Search in Sitefinity, hopefully this will fix your problem.

Darrin Robertson - Sitefinity Developer

Thanks for reading and feel free to comment - Darrin Robertson

If I was really helpful and you would buy me a coffee if you could, yay! You can.

Leave a comment
Load more comments

Make a Comment

recapcha code