Media Library Browser Missing Items Pulled by Search with Solr

Vasiliy Fomichev

In Errors, Sitecore Fix Posted

It seems like the Sitecore with Solr configuration and provider code are still in their toddler stages, there are a few quirks, however, it seems as Sitecore is working hard on fixing them. Again, following on of the best practices of Sitecore development – sharing the found bugs, I rushed to publish this quick article describing one of the issues that I ran into recently setting up a Solr solution for a client. The bug is related to the Web API DateTime calls and the new Media Library SPEAK browsing client interface.


Problem: Files not Showing up in Search Media Library SPEAK View

No items found - media library missing items - Sitecore with Solr

Missing Media Library items when using Sitecore with Solr.

After following the steps outlined in the Sitecore Search Scaling Guide to setup Solr on my local development environment everything seemed to work fine, besides the Image Field Browse button, which when clicked did not show any Media Library items. Sitecore 7.1 has introduced a new SPEAK interface for browsing assets in the Media Library using search (Sitecore is undergoing a facelift, slowly replacing the XAML UI dialogs with more conventional HTML SPEAK framework).

The problem we have encountered was that none of the assets were found when the Browse button was clicked and we were forced to switch to the conventional hierarchical view to find the uploaded media files. In our logs we also noticed the following error come up every time we hit the Browse button on an image field:

ERROR [Item Web API] String was not recognized as a valid DateTime.

Exception: System.FormatException
Message: String was not recognized as a valid DateTime.
Source: mscorlib

at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)
at Sitecore.ItemWebApi.Facets.UpdatedFacetProvider.GetFacetValue(String value)
at Sitecore.ItemWebApi.Pipelines.Request.Search.GetFacets(IList`1 facetProviders, FacetResults facets)
at Sitecore.ItemWebApi.Pipelines.Request.Search.RunSearchPipeline(RequestArgs args, String searchText, String languageName)
at Sitecore.ItemWebApi.Pipelines.Request.Search.Process(RequestArgs args)
at (Object , Object[] )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.ItemWebApi.Pipelines.HttpRequest.LaunchRequest.Process(HttpRequestArgs arguments)

We have not tested other types of fields that use the same browsing functionality, however, it is likely that those fields would experience the exact same problem with missing Media Library items that get pulled in by the search with Solr. So if you are one of the developers that got to setup Solr with Sitecore 7-7.1, and are affected by the same but – read on!


How to Fix the Media Library Browser issue with Solr

After some time of digging through the search dlls with a reflector, the root of the issue seemed to be located in the ContentSearch provider. I have contacted the Sitecore Support and they were very quick to recognize the bug and provide the solution. Unfortunately, as usually, there is no ETA on the fix being included in the Sitecore build, until, then the fix below should do the trick (with that being said there is no knowing which future updates to Sitecore will continue to have this bug, therefore, although we are currently talking about Sitecore 7.0 – 7.1 being affected, future releases might be as well).

To resolve the Media Library Browse button issue please follow these steps –

  1. Place the attached Sitecore.Support.406795.dll file into the /bin/ folder of your CMS;
  2. Place the attached Sitecore.Support.401115 file into the /bin/ folder of your CMS;
  3. In the /App_Config/Include/Sitecore.Speak.ItemWebApi.config file replace the line:
    <processor type=”Sitecore.ItemWebApi.Pipelines.Search.FilterItems, Sitecore.Speak.ItemWebApi” />
    with the following line:
    <processor type=”Sitecore.Support.ItemWebApi.Pipelines.Search.FilterItems, Sitecore.Support.401115″ />
  4. Open the /sitecore/client/Sitecore/Common/Dialogs/SelectMediaDialog/PageSettings/Facets/Uploaded item in ‘core‘ database
  5. Replace its value:
    with this one:
  6. Rebuid the indexes and try to reproduce the issue

After following the steps above, the Media Library SPEAK search browser should display the media items and the Web API errors should go away as well, boom!


Hopefully, this post will save many hours of frustration or days of troubleshooting to others, so please share this article, as many developers will thank you. Also remember to comment on this article, especially if you were affected by the same bug and this fix worked for you; please mention the version and revision of Sitecore you experienced the same problem on. Finally, give back by blogging, tweeting, and posting on Sitecore forums about any bugs and fixes you find yourself!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.