Enterprise Search Web Parts are still Sealed! Unseal them! (SP2010)

Posted Wednesday, December 9, 2009 3:44 PM by CoreyRoth

I am pretty passionate about Enterprise Search and with MOSS 2007 I saw customers really struggle because wildcard search was not offered out of the box and most of the web parts in Microsoft.Office.Server.Search.WebParts are sealed.  Luckily, the most important one CoreResultsWebPart was in fact not sealed and I was able to hack together a wildcard search solution by inheriting it and using some hacky reflection.  Since SPC09, we’ve been hearing “the search web parts are no longer sealed”, this unfortunately is not true at all.  What they mean to say is that they have added a couple of override to CoreResultsWebPart that allow you to affect the query going in and the results going out.  This is a nice win, but there is still more desired.

It took me asking a lot of people at SPC09 to finally get a straight answer.  It was in the session, Customizing Search in SharePoint: Building Great Sites with Search, where I asked Harneet Sidhana at the microphone to get the story on why most web parts are still sealed.  The answer? The remaining web parts are currently still sealed by design.  The audience “booed”.  Seriously, they did.  I then asked to have the web parts unsealed and the audience applauded.

Let’s take a look at the web parts between MOSS 2007 and SP2010 Beta 2 and see what is sealed.

Web Part

MOSS 2007

SP2010 Beta 2
AdvancedSearchBox Sealed Sealed
CoreResultsWebPart Unsealed Unsealed
FederatedResultsWebPart Unsealed Unsealed
HighConfidenceWebPart Sealed Sealed
PeopleCoreResultsWebPart Sealed Sealed
PeopleRefinementWebPart   Unsealed
QuerySuggestionsWebPart   Unsealed
RefinementWebPart   Unsealed
SearchPagingWebPart Sealed Sealed
SearchStatsWebPart Sealed Sealed
SearchSummaryWebPart Sealed

Sealed

TopFederatedResultsWebPart Unsealed Unsealed

Looking at this list, I don’t really see anything that has changed from sealed to unsealed. Do you?  I will point out that CoreResultsWebPart has always been unsealed, but this is because PeopleCoreResultsWebPart inherits from it.  Did you notice that anything built since the Infrastructure Update of MOSS 2007 has been unsealed?

Now I admit, the main reason we wanted to inherit from these controls was to do wildcard search.  The Enterprise Search did a great job with the new keyword query improvements and this will be a non-issue now.  However, can they really say we will never want to extend their web parts?  Are they going to say that they have thought of every possible thing that the web part might possibly do and no one will ever extend it?  As a programmer, I don’t think I would ever have the guts to make a claim like that.  I know these web parts will require customization in the future.  Give us the ability to do it.

I know you might be thinking, “We just wanted to inherit from these web parts because we wanted wildcard search.  We have that now.”  This is true and I am very thankful.  This eliminates the need a lot, but more than likely we might need to make a change to something else though.  Want to customize people search?  What about best bets or the advanced search box?  Most web parts in SharePoint are unsealed, so why are the search web parts sealed?

The PeopleCoreResultsWebPart still being sealed is a huge deal.  For one, it doesn’t appear to support the new QueryManager class which means you can’t customize how it does queries or builds the results.  I need to confirm this though.  Take a look at the forums.  They speak for themselves.  Fifty results for the term wildcard in the Search forum.  I am passionate about this topic because I have seen the needs of my customers.  The fact that I might be stuck with another set of sealed web parts for another 3+ years is absolutely scary to me.

So what can we do?  Please post a reply in the forum or leave a comment on the blog.  We need to let them know our concerns while there is still time to make a change.  Please, unseal the web parts.  This post is cross posted to the SharePoint 2010 forums.

Comments

# Twitter Trackbacks for Enterprise Search Web Parts are still Sealed! Unseal them! (SP2010) - Corey Roth - DotNetMafia.com - Tip of [dotnetmafia.com] on Topsy.com

Pingback from  Twitter Trackbacks for                 Enterprise Search Web Parts are still Sealed! Unseal them! (SP2010) - Corey Roth - DotNetMafia.com - Tip of         [dotnetmafia.com]        on Topsy.com

# Sharepoint 2010 Search Web Parts unsealed (partially)

Sunday, January 10, 2010 3:06 PM by Sharepoint 2010 Search Web Parts unsealed (partially)

Pingback from  Sharepoint 2010 Search Web Parts unsealed (partially)

# Social comments and analytics for this post

Wednesday, January 13, 2010 5:03 AM by uberVU - social comments

This post was mentioned on Twitter by jthake: #SharePoint #Link: Enterprise Search Web Parts are still Sealed! Unseal them! (SP2010) - Corey Roth - DotNetMafia.c... http://bit.ly/6ncqPo

# re: Enterprise Search Web Parts are still Sealed! Unseal them! (SP2010)

Tuesday, February 23, 2010 12:55 AM by Gunnar

Well... you do what you always do with legacy code problems like this: you create your own wrapper class that uses same public interface as class you are wrapping. Wrapper class will be unsealed and allows extending. That's all you can do going nice way.

Of course... if you are brave code terrorist and you are very sure what you do then you can always to what you ever you want to do using reflection and dynamically created code. It is way more complex thing to do and harder to debug but at least on dynamic level you can create copy of sealed class and make it unsealed. I suggest you to find better method than this.

# re: Enterprise Search Web Parts are still Sealed! Unseal them! (SP2010)

Tuesday, February 23, 2010 1:00 AM by Gunnar

I forgot to mention quickest way. Take Reflector and disassemble sealed class. Add it to your project withoout sealed keyword. In this case you have to be ready to modify disassembly results because code that Reflector disassembles may be problematic.

The other option is more complex. Use ILDASM to generate IL file based on sealed class. Remove sealed keyword, change namespace and/or class name and create DLL using ILASM. You can reference this DLL from your projects.

# re: Enterprise Search Web Parts are still Sealed! Unseal them! (SP2010)

Tuesday, February 23, 2010 8:08 AM by CoreyRoth

Good comments.  The code terrorist way is actually the way the wildcard search web part works (via reflection).

wildcardsearch.codeplex.com

It's not pretty but it does work somewhat successfully.  I've only had one real case reported where it was a real performance issue.

Leave a Comment

(required)
(required)
(optional)
(required)