I've been working on a developer tool off and on for months now to help working with the query engine in SharePoint 2010. It's come far enough along that it's probably ready for some folks to start using it. I've been debating about putting it up on CodePlex as more of a community project so others can contribute and enhance but haven't fully committed to doing that just yet.
I wrote the tool originally as an upgrade to the old MOSS Query Tool for SharePoint 2007 (which was an upgrade from my original SharePoint Query Tool for SharePoint 2003; yes, I really have been around that long). I added quite a few enhancements from the old MOSS Query Tool though so it really is a lot different. I added an entire screen just for managing parts of the search service from this application. I got tired of constantly going back and forth between my query tools and the browser, trying to change things in the search service and then find out what their new values were, etc. So to deal with that the first screen when the application starts gives you a bunch of information on the search service. You actually click a button to get the list of search services since you can have more than one now, and it will retrieve them all, including proxies for search services you are consuming from other farms. When you get the details of a search service you can do things like see all of the content sources, get the crawl status and get the list of start addresses for that content source. You can kick off a full or incremental crawl from right in the tool, and you can also add and/or remove additional start addresses for a content source.
Here's an example of the home screen on the tool; I kind of "time-lapsed it" so to speak so you can see the different short-cut menus:
At the top of the screen you'll see some basic info about the search application, which you can also modify from this tool. Of primary interest is probably the query logging and enabling query suggestions. There's a keywords and best bets section so you can easily find the best bets you've defined in different site collections and know what to expect for different queries you execute. The Crawl Rules section lets you know all of the crawl rules that are defined for the search application in case you're wondering if something is being excluded or crawled differently in some way. In the Managed Properties section you can see all of the managed properties defined in the search application. The view here displays just a few properties of the each managed property (and you can also change the Use In Scopes right here on this screen), but if you double-click on a managed property then you get a separate dialog with ALL of the properties for that managed property. You can then change those attributes of the property from that dialog. Here's what that looks like:
The scopes section shows the different scopes that have been defined. It also lets you see things like whether it shows up in the admin UI, alternative search results pages, etc. Finally, the bottom section of the screen shows any FAST User Contexts properties. These are the properties that can be used to create user contexts for FAST Search for SharePoint, as I described in this blog posting: http://blogs.technet.com/b/speschka/archive/2009/12/09/using-custom-properties-to-create-a-fast-search-for-sharepoint-2010-user-context.aspx.
When you click the Queries tab you flip over to a screen that's very similar to those of you that have used the MOSS Query Tool in the past. This is where you can actually create your queries to execute against SharePoint or FAST and get some search results back. Here's what it looks like:
Again you see a list of all the managed properties. You can check the Include box next to any managed property to have it returned in your query results. You can type query criteria for any managed property in the Criteria column. You can also type words to find anywhere in the documents or items in the Query edit field. Like before, at that point you can click the Make SQL button and it creates the SQL that is used against the SharePoint query web service to execute the query. When you press the Run Query button it will execute your query and show a new dialog with the results. Here's one example of some search results:
In the query results you get some important stuff. At the top of the screen is the Xml that was sent to the query web service to execute the query. So if you're using the object model to query then you can copy the SQL right out of the Queries tab; if you're using the Search web service then you can copy the Xml right out this search results page. You also see all of the matches that were returned from your query so you know if your query is working successfully. On the bottom part of the screen you will see some additonal data that was returned (assuming you asked to see the results as a dataset rather than Xml). The best bets grid on the right shows Visual Best Bets from FAST. The Special Terms grid in the middle shows best bets that have been added in site collections for SharePoint search. And the Refinements grid on the right shows any refinements that were returned in the query; this only works when querying FAST and you check the Include Refinements checkbox on the Queries tab.
Adding support for FQL (FAST Query Language) is really the biggest improvement here from the MOSS Query Tool. FAST doesn't support the SharePoint Search SQL syntax, so you are limited to either doing keyword or FQL queries with a FAST search application. Keyword queries should be pretty straightforward, but FQL is a brand new animal to most of us SharePoint people. To help move the learning curve along, the Queries tab includes a drop down that says Select FQL... That drop down contains a number of different sample FQL queries. It's an easy way for you to drop in a different FQL clauses and matching options and play with them to see the different things you can do in FQL. I've also included a link above that which takes you to the FQL syntax help on MSDN. So if you are looking at different FQL options in the drop down and are confused about how they are working, just click the link to bring up the FQL help and read further. Here's an example of a simple FQL search result that shows some refinements returned as well:
So that's kind of it in a nutshell, it should at least be enough to get you going and thinking about how you might use it. For what it's worth, I've always found this tool and MOSS Query Tool etc really useful. Not only for when I'm doing my own custom search development, but even more so when I'm trying to troubleshoot what seems like a search problem in a farm. There's nothing like being able to pop out this little tool and run all sorts of custom queries to help nail down where I think a problem might exist. I've added a ZIP attachment to the post that contains the files you need to get it going. If you have suggestions for things you'd like to see feel free to leave them in the comments. As I was saying, if there is interest in moving this to CodePlex and having others work on it (because I'm frankly kind of tired of working on it now) then I may do that as well. Hope you enjoy.
Update Aug. 20, 2010: Added support for creating and managing mapped properties. A stupid omission in the first place since that's one of the most common things you do with custom search development. Also added support for updating the crawl status for a content source. So now you can see what's going on when you kick off a crawl.
Update Aug. 22, 2010: Added support for exporting all the attributes of a managed property to an Xml file so you can review it offline. Added support for importing from the same format Xml file so you can copy how one managed property is configured to another managed property.
Love the idea and layout of the tool, and downloaded it and set the config as I thought but get an object error when I click the button to list the service application lists - is there a dependency or config item I am likely missing?
Make sure you're running Search Explorer on a SharePoint server; all of the search management stuff requires the OM. If you just want to do queries you can take the DLL that comes with the download and add it to your own WinForms app. The DLL is a custom user control that is the query page you see on the second tab.
This will be a nice addition to fastforsharepoint.codeplex.com which is query only. Good work!
When i run the query and generate the XML, the program returns data (data i'd expect to see) but when I'm in SharePoint Designer 2010 - using this xml in a SOAP data connection will return no results and something about a 'non specific error'.
Any idea what might be happening?
Very helpful tool!!
Any chance that you will provide the source code for it? So we can extend it ...
I am also getting the "Object reference not set to an instance of an object." Error when I click the "Get Search Apps" button. I have it running on my SharePoint server. Has anyone else run into this? Is there a solution or a work around for this issue?
The utility crashes on start-up in my Hyper-V VMs. It does run on my Hyper-V host.
Nevermind: the utility crashes when SharePoint is not present. It would be nice to handle error cases more gracefully.
Thanks Steve. Great stuff and useful as hell.
Thanks for the great work. I like your tool: it's very usefil. I think, it's one of the must-have tool for every sharepoint developer.
I think I figured out why it was throwing an error "Object reference not set to an instance of an object." when I clicked on "Get Search Apps" button. It was the permissions issue. If I login to SharePoint server as a farm admin and run this tool, it works fine. In short, you need to run the application with the account with appropriate permissions
By the way, it is really nice tool. Thanks Steve.
Thanks for the amazing tool..great for FQL beginners
I am getting following error on my intranet system and we are using https for intranet:
"Error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."
Does this tool not support https?