I’ve been doing a lot of work with SharePoint search lately and specifically the KeywordQuery class, properties and methods.
If you want the result set to return results above and beyond the usual suspects (see here), you add it to the SelectedProperties collection, as in:
myKeywordQuery.SelectProperties.Add("xyzzy");
Many thanks and a tip of the hat to Corey Roth and this enormously helpful blog post (http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/02/19/how-to-use-the-moss-enterprise-search-keywordquery-class.aspx)
In my case, “xyzzy” isn’t actually a managed property. When I added it to SelectedProperties anyway, SharePoint threw one of my favorite ever runtime exceptions:
“The creator of this fault did not specify a Reason.”
I especially like the capital “R” in Reason. This sounds to me like the .NET equivalent of “I have no mouth, and I must scream.”
</end>
Follow me on Twitter at http://www.twitter.com/pagalvin