Community Server Search Fix

September 12, 2006

We got a question today in the MyHomePoint Bugs & Problems forum asking about the ability to search the forums. It seems that during the course of merging our application and Community Server content/blog/forum framework, that we opted to replace the standard Community Server login/register/search header with our own header with pointers to our own Log In and Demo functionality. Unfortunately, once we got our pieces in place, we neglected to relocate the Community Server search functionality down into the forums when we were done. Actually, that isn’t entirely true. Once I got to digging around in the code tonight, I realized that I did attempt to move the search functionality but ran into issues.

The way search works by default in CS, is that if you are at the root of the forums, then only a textbox and Search button were displayed. When you went into a forum, then the search changed to include a dropdown for the scope of the search. Using the dropdown, you could search either that particular forum, a top-level group, or the whole site. Overall, pretty nice functionality. When it was in the Title Bar.

Unfortunately, when I tried to move the search controls down into the Forum Master control, then everything kind of tanked. The dropdown rendered regardless of where you were at and it was always empty, and the Search button was missing it’s label. My assumption was that the code-behind for Search was tied to the Title Bar control, but at the time, we were working with a version of CS that didn’t come with the source code, so I had no way to verify that assumption or remedy the situation. And obviously with more pressing matters to deal with rolling out the application, it was soon forgotten. Until today.
Since we had upgraded to Community Server 2.1 a while back and they had released the source code for 2.0, it was pretty trivial to verify that the render and event logic for Search was tied to the Title Bar code-behind. However during the course of my experiments with whether or not search would work with only a textbox and button, I discovered that I wasn’t getting results for any of my searches, regardless of whether or not they came from my hacked version in the forums, or the original version from the header. Which brings me to the point of this post.

It appears that CS is using the String.GetHashCode() method to tokenize the posts as part of the search indexing process. Unfortunately, GetHashCode() is documented as potentially being inconsistent from one version of the CLR to the next. The justification is that from one version to the next, the internal algorithms could change for efficiency or performance (or whatever) reason. Jayson Knight does a far better job documenting the details of the issue and Rick Reszler provides the specific bit of SQL for truncating and getting everything ready to go to be re-indexed. Thanks guys for the posts. The only bit of extra information that I would pass along is that running the SQL does not immediately fix everything. You have to at least give it enough time to come back around and re-index the posts. In my case, it only took a couple of minutes before I was able to see that it was working.
While that solved our search results issue, it still didn’t solve the issue with the location of the search fields. In theory, we could get the source and make the appropriate changes to allow search to be where we wanted, but that is a lot of overhead and more than what we want to tackle at the moment. So, the quick fix is to just make a link to the search page and be done with it.
Fortunately, it took less time to solve the no search results problem than it did for me to write up this post (I used the Search on the CS forums), but I’ve been meaning to dedicate more time to posting solutions to tricky technical opportunities I run across. Hope the extra details help someone.

Popularity: 4% [?]

Comments

5 Responses to “Community Server Search Fix”

  1. Prog on September 13th, 2006 3:03 pm

    Community Server Daily News for Wednesday, September 13, 2006

    news of the day a grab bag for what’s happening in Community Server J-O Eriksson recommends reading Dave

  2. External News Feed on September 13th, 2006 7:31 pm

    Community Server Daily News for Wednesday, September 13, 2006

    news of the day a grab bag for what’s happening in Community Server J-O Eriksson recommends reading Dave

  3. Subcontractors.ie on September 14th, 2006 3:09 am

    Community Server Daily News for Wednesday, September 13, 2006

    news of the day a grab bag for what’s happening in Community Server J-O Eriksson recommends reading Dave

  4. Daily News Faq List on November 22nd, 2006 10:18 am

    Community Search String.GetHashCode() inconsistencies between ASP.NET 1.1 and ASP.NET 2.0

    Matt at Swoofware elaborates on the Community Search String.GetHashCode() inconsistencies between ASP.NET

  5. Community Server Bits : Community Search String.GetHashCode() inconsistencies between ASP.NET 1.1 and ASP.NET 2.0 on March 12th, 2007 9:25 am

    […] Community Search String.GetHashCode() inconsistencies between ASP.NET 1.1 and ASP.NET 2.0 Matt at Swoofware elaborates on the Community Search String.GetHashCode() inconsistencies between ASP.NET 1.1 and ASP.NET 2.0. Published Wednesday, September 13, 2006 11:56 AM by daveburke […]

Got something to say?





MyHomePoint

Having trouble keeping track of everything going on at home? Is the refrigerator organizer not cutting it anymore? We feel the same way...
Check out MyHomePoint »

Close
E-mail It