Friday, March 18, 2011

How to Add Custom Columns to the Search Results in MOSS 2007

A few years ago I demonstrated at the New Zealand Conference how to add custom metadata columns to your search results. What I never did was make a blog post about it. So let me rectify that error of mine.

To get custom columns to appear on your search results page in MOSS you will need to do a few things. First make sure the metadata field is indexed and available by adding it to the Mapped Metadata Columns in the Search Administration of your SSP. Then, recrawl your index. And finally show the new column on the search results page by tweaking some xml and xsl.

1) Get the column indexed and mapped
To do this, open up your SSP admin site either directly or via Central Admin. Then navigate to the Search Administration Page and look for Managed Columns on the left menu. There you will need to add a new managed colum which mapps your custom field. This field could be in a SQL Store indexed via BCS or in a custom list or in a custom content type. In any case I assume that you have already crawled all the content in question, otherwise this step won't work.
2) Recrawl the index
Once you have added the managed metadata colum you need to do a full crawl. Sorry, no incremental crawls will work, as only in a full crawl does the engine do the mapping of all existing fields in the index.
3) Customise the Search Results
Browse to the search results page in your Search Centre. Fastest way? Type in a search into any search box! If you farm is configured correctly that should catapult you to the correct page.
There you need to edit the page and customise the Core Search Results WebPart.

Before you edit the actual XSL Look and feel you need to tell the webpart about the new column. So first click the three dots next to "Selected Columns". You find this option under the ResultsQuery Option. (refer to above screenshot) Copy the text out of the editor into notepad. You'll get this:
Well, you won't get that exactly. It will all be on one line and illegible. Feel free to use an xml editor of your choice instead of notepad.
In that xml you now need to add the Mapped Metadata column name. Make sure you use the correct case. XML is case sensitive! Also add the name you gave the mapped column and not the source metadata column (in case these two have different names). Once you have added the column to the xml text copy it back into the popup for the "Select Columns: option.

(note the new MyCustomColumn entry at the bottom)
Once you have added the xml for the new column you can add the column to the output in the XSLT.
Click the XSL Editor button on the WebPart customisation interface (see first screenshot) and add the new field to your xsl.

Extract before you add the markup:
And now with the new data appearing right next to the description of the search result:


That's it. Copy the changed xsl back into the XSL editor popup, apply your changes to the web part and test your results by executing a fresh search which includes some of the custom metadata that you have indexed.
The next step would be to create a custom scope for your BCD indexed data, create a custom search page and search results page for that scope and go ape-shit on the search results page with loads of custom columns and custom look and feel.
Happy Customising folks!

Monday, March 14, 2011

How to pass 70-576

Totally forgot to post the fourth post in the series. If you want to earn your sharepoint 2010 professional developer credential then you'll also need to pass this exam. Measureup does not have this one on it's books yet, so no legal cheating on this one.
The questions are not quite scenario based as with many of the .Net developer pro exams. But not quite as code driven as the TS exams. Expect simple scenarios with simple seeming answers.
Actually there are quite a few trick answers where there seems to be two valid choices until you spot the error. My best advice on this exam is to eliminate the wrong answers. Quite a few will be obvious bull answers, but there will be the occasional one that will make you doubt. Re-read the question. Often there is a clue or constraint in the mini scenario which will eliminate the second option.
A lot of questions are common sense on development and deployment techniques. Make sure you're up to scratch on best practices for features, solutions, dependencies, upgrading and the new 2010 features.
Warning! Only because it is a new feature in 2010 doesn't mean that it must be the right choice!
Last tip, as with any Microsoft exam, stick to your first gut choice when in doubt. And only move from that when you are 100% sure that the new answer is the correct one.



Thursday, March 10, 2011

Air New Zealand 777-300 Review

Just had the pleasure of viewing one of the new 777-300 planes from Air New Zealand. A lot of good things and a few bad things to comment on:
Great:

  • Arm rests fold up in economy. Great if travelling as my wife and I normally do.
  • Sky couch can hold two people who weigh up to 150kg each. (300 Pounds on the leg rest alone)
  • Touch Screens work like a charm and at last no need for the annoying remote control
  • Remote/Phone stowed in-front and not in the side (why did they not think of that earlier?)
  • New menu is supposed to be much better (I'll wait and see)
  • Power sockets also in economy. (Which laptop battery lasts for 12h-24h?)
  • Headrest holds up! (That drove me mad in the old planes. Always falling down again.)
  • Special cushions that attach to headrest. No more fussing with the cushion when standing up and sitting back down again.
  • Sections are shorter with an added canteen in the middle. Means less people running past and faster service all round.

Not so Great:

  • Seats narrower and Aisles narrower in economy.
  • Premium Economy lacks leg-room due to hard case shell design of seats. Max height for premium economy passenger: 178cm. Anything beyond that and you're bound to get sore legs as you can't stretch them completely. 
  • SkyCouch not very spacious. Gonna be very cuddly! And be sure not to stretch your legs or you'll hit the person in the middle aisle.

Secret Tips:

  • Three rows of two seaters at the back of the plane. Great for couples. Also have 1inch more leg-room!
  • Don't take a seat in the 3-person row right in-front of those two-seaters. Armrests don't go all the way up but are stuck at horizontal. 
Summary:
All in all I am looking forward to flying long haul in the new Boeing 300s. It looks like it will be very enojyable  and no, I won't be upgrading to premium economy on those flights. Unless I could choose my seats before booking the flight. Now that would be just perfect!