In this post, I plan to provide some top-level query debugging tips for SharePoint 2013 Search. I plan some follow up posts but I'm going to start small and build.
My search career has its roots in the old FAST Search and Transfer company so my technical roots are in FAST ESP. ESP, and even FAST Search for SharePoint 2010, provided a very simple way of debugging queries: the ESP query logs. Unfortunately, in SharePoint 2013, there is no isolated query log and SharePoint writes all query logging to the SharePoint ULS logs. In fairness, ULS stands for "Unified Logging Service" so it stands to reason that the query logs would live there.
The first thing you need is a tool for analyzing the ULS logs. I used ULSViewer available on MSDN but any tool, including scripts, that can read and filter on the log entries will do.
For this first post, I am going to focus on a specific issue I encountered.
I had posted some PDF's to a file share and setup a new content source to crawl that file share. After the full crawl completed, I ran a search. Couldn't find them. Hmmmm… maybe the system is still indexing, I'll give it a few minutes.
A few minutes later, I search again. Nothing.
I double check the crawl logs. A bunch of warnings but no failures.
I decide to look into the ULS logs to see if there's anything that might indicate an issue with either the query, the crawl or something else. It took a few minutes and a review of some messages with the product team and I finally figured it out.
First, based on some hints, I filtered on messages with "Query Processing" in the Category field. For a single query, it showed this:
The highlighted log entry shows my original query: "msdn" but all that was being returned was the federated query to Bing :-(.
I was baffled and was wishing I could have my old ESP 15100 QRServer interface back. Then, I looked through a small set of ULS log entries I had and found this:
Why is "Title=Paul" in there and where did it come from? … QUERY RULES!!!! I had created a query rule to demonstrate boosting based on certain tokens in the title of the document.
I deactivated my query rule and WAH-ZAM! my query started working and there were all of my file share documents. You'll also notice that there is an additional filter in there which excludes people profile content. That comes from the Result Source. The default result source excludes people profile content by default.
What else is out there? I'm looking and I'll let you know when I find out.
Have you ever heard of a query rule limit? My client has a need for 18000 query rules, but we received an error in logs that referenced a 5000 query rule limit in SharePoint Server 2013. Is this a setting somewhere?
Yes, there is a cap in Sproc which hits up to 5000. Of course, you can go in and boost it up but be careful since it would void your support from MS.