Recently, we encountered an interesting and quite unexpected issue while working on a publishing site based on SharePoint 2013. Let me share some details on that particular scenario and a simple workaround in case you come to struggle with the same problem.
A client of ours has a large number of pictures that they use when authoring content for a publishing site. They store the images in the Site Collection Images library. To make it easier to classify the images and simplify the work of content authors, they added a Managed Metadata field named Category to the library. This works pretty well since a new feature in SharePoint 2013 now allows to conveniently sort and filter by taxonomy fields in the list view:
Recently in one of our projects we had to write some code to get items from a list in SharePoint 2013 using CAML. “Easy Peasy Lemon Squeezy” … I hear you say. It should be quite trivial especially given the fact that CAML has been around since SharePoint Team Services – the very first version of the platform.
Well, not so fast. If my experience as a SharePoint consultant has taught me anything, it is that even the most seemingly trivial task in SharePoint can kill you a couple of hours. That is – if you are lucky.
So let’s see where the catch is in querying Boolean fields with CAML.
A result source in SharePoint 2013 is used to segment certain types of content so they can be searched in a narrower fashion than searching against all content within the index. Using result sources, we can define query rules that must be met by the content in order for it to appear in search results. In previous versions of SharePoint this concept was addressed through search scopes.
SharePoint 2013 presents us with user interface in Central Administration where we are able to create new result sources and configure their properties:
However, at the time of writing this post, there is no Windows PowerShell cmdlet available to create a result source in SharePoint 2013. This is rather limiting, because as user-friendly as the browser interface is, we still need a way to automate search configuration, especially when developing and deploying solutions for a customer. It’s a fact of life that most SharePoint administrators do not make a happy face when being handed a thick document with manual actions to execute, especially if it needs to be done several times on different environments.
I have to admit SharePoint really got me with this one.
We had built a SharePoint Server 2013 environment for development and research purposes as soon as the RTM version was released. I remember configuring the Search Service Application and creating a Search Center to play with the new features back then, and everything was working quite well.
Then a couple of days ago I started creating a proof-of-concept for an upcoming SharePoint 2013 project, I fired up my suspended virtual machine only to find out that search had stopped working.
In the Search Center I was getting “Unexpected response from server“: