Issue:

SharePoint Search displays “Error from SharePoint site: *** Index was outside the bounds of the array.” in the crawl logs and the users are not able to find the affect file in search.

This issue is caused by improperly mapped Managed Metadata Column fields. The issue itself can be triggered a number of different ways. One of them which is prevalent in my environment is the Data Sheet View when used with Custom Libraries. I know what you’re thinking, the datasheet view does not support MMS columns and they are set to read-only. This is correct if the MMS field has already been populated. However, if the MMS field is blank, we are able to enter data into it. In my case the users were using the Data Sheet View as a bulk edit tool for MMS. They would map one item correctly, then copy the data (ie. “180;#Test:24: MECHANICAL”) and then paste it in the subsequent fields. From the SharePoint end everything would look fine. However, when search crawls the document, it would error out with “ The SharePoint item being crawled returned an error when requesting data from the web service. ( Error from SharePoint site: *** Index was outside the bounds of the array. )”. This would cause the document not to appear in the search results as the document is ignored once an error occurs.

The issue is clearly visible when looking at the SPListItem.Xml Property . I have posted a script on the Script Center which will get the data quickly. Get Crawled Property Names

Below are screenshots of two files in the same library. As you can see in the bad file, TaxHTField field begins with |Guid while it should be Term|Guid.

Solution:

The solution to this problem begins at finding the reason that MMS fields are not mapped properly.

This could be caused by:

  1. Entering MMS Fields using Data Sheet View
  2. Improperly setting the field data programmatically
  3. Backup/Restore

Once the cause has been found it needs to be resolved. In my case I have set Default Values for the MMS Fields, this disallows the users from entering the data using the Data Sheet View.

The next step is to deal with all of the items which have this issue. If the count is small simply edit each file and reselect the MMS Fields using the picker and save the items.

If you’re unlucky like myself, you will have more than 500 items with this issue. I was able to script the full repair process.

Get-SPSearchCrawlLogs: http://gallery.technet.microsoft.com/scriptcenter/Get-SharePoint-Search-a55da58b

Repair-SPMMSMappings: http://gallery.technet.microsoft.com/scriptcenter/Repair-Orphaned-Managed-824159e3

  1. Run Get-SPSearchCrawlLogs on the Farm containing the Search Service
    • It will display all the Document URLs which are experiencing this issue
  2. Run Repair-SPMMSMappings with the Document URLs from above on the Farm containing the associated Web Application

If you have any questions/comments you can leaven them blow.

Enjoy!

Written By:

Softlanding

More By This Author