Helper Classes for the SharePoint Server 2007 Search Query Web Service
Sometimes, things just kind of grab hold of you, don't they? A corridor conversation leads to quickly popping into a meeting to give a bit of advice, and this leads to suddenly being given actions. And then, the sense of responsibility kicks in and you find yourself going the extra mile and coding something up to help make something easy.
It happened that way when I bumped into a colleague who was just going into a meeting. When the conversation turned to what he was doing, he mentioned that he was going into a meeting to discuss an internal project. It was nothing fancy or super-secret; in fact, it was a problem that I've been helping businesses with for the last few years. We have a series of community sites that are maintained by our technical team leads and subject matter experts. One of our senior managers wanted a single mechanism by which everyone could search all this content as well as publishing information that was relevant to the whole group. I quickly gave my standard "information portal coupled with enterprise search" speech and found myself invited to the meeting to repeat it.
So, I found myself helping out. One of the neat ideas was to use the search capability as an internal research and training exercise so that folks could play with developing a simple Silverlight application. No problem, I thought. This is going to be easy for me as all I have to do is set up the site, configure the search to crawl the team site, and the Silverlight developers can invoke the search web service. I could get the job done with minimum effort and maximum kudos.
Then the sense of responsibility kicked in. As I looked at the search web service, I realised that it would be really helpful if I gave the Silverlight developers a set of helper classes. These helper classes would make it easier for them to submit a query without having to worry about building XML query documents and invoking web services. After a few trials and errors, I ended up with three main classes: QueryRequest, QueryResponse, and MossQuery. The QueryRequest class is used to define the query that will be fired in, MossQuery actually invokes the Search web service and it massages the result to build a QueryResponse.
And then I thought, "Hey, I bet other folks could make use of these classes …" So I wrote an MSDN article that walked through the code and explained how it all worked. I popped the project up on Codeplex and was then invited to write an entry to announce it here.
So, let me know how it goes, and if the code is useful.
And if I bump into another colleague, perhaps there'll be another little coding project for me somewhere else ...
Callum Shillan
Solution Architect
Microsoft Consulting Services UK
Comments
- Anonymous
October 02, 2007
PingBack from http://www.artofbam.com/wordpress/?p=4743