Keywords and Best Bets are an interesting feature of MOSS 2007.
If you don’t know how it works, here is a little explanation:
“Keyword Best Bets are relevant items that you can choose for a subject. You add keyword Best Bets to a keyword to mark the items that are most relevant for that keyword. When a portal user types a keyword into the search box, all keyword Best Bets for that keyword are displayed prominently in search results.”
First of all, we like to categorize our best bets, so that users aren’t clicking “mystery meat navigation“. Here are our categories:
- Application (links to a Web Application such as time management, project management, etc)
- Blog (links to a blog)
- Discuss (links to adiscussion forum)
- Doc Folder (links to adocument folder)
- Document (links directly to a single document)
- Download (links to a download-able a file, like a zip file)
- Email (links to a mailto: link)
- Form (links to a web form)
- Item (links to a single item in a list)
- List (links to the default view of a list)
- Search (links to a ‘better’ search term)
- Site (links to an internal web site)
- Survey (links to a MOSS Survey)
- Video (links to a video file)
- Web (links to an external web site)
- Wiki (links to a Wiki site)
So, for example, our Best Bet URL would be http://www.fedex.com/ and the Title would be “Web: FedEx”
That is just a little tip for “Best Practice.”
Limitations of each SSP instance:
- Only Site Collection Administrators can manage Best Bets (this sucks!). As a Site Collection Administrator, I wash my hands of maintaining any site content. This should hold true for Best Bets too, but I can see why, as this is at the SSP level, a SCA must get involved, oh well.
- Any keyword’s description field is at most 500 characters.The description field is only 500 characters, and it is a rich-text field, which means it populates it’s own HTML, and there is no telling how many characters of HTML-goo that rich text editor is placing there. (side note: we call Word HTML “Word Goo” because there is so much of it in a document source, and it is very hard to get rid of).
- There are only 15 Best Bet URLs that can be entered into the SSP. I am not sure why this hard limit exists, but it does.
- Only one instance of any URL can exist in the SSP (see “quirks” below for a hack). Some of our business practice rules come into play here, such as: Don’t link to a “*.aspx” page – only link to the site level, leave out “pages/*.aspx”, so that the MOSS server will direct the user to the correct welcome page. Link to the list, not the view, in the same way (don’t link to “AllItems.aspx”).
- Only one instance of a keyword or synonym can exist. If we have a term that has multiple meanings, then you have to include all of the Best Bet URLs to that term.
I found a hack to get around this – if you use HTTPS (and who isn’t?), you can enter the URL as “HTTPS” protocol, and then enter it again with a different title, and point it to “HTTP” – MOSS will automatically change the protocol to HTTPS, even in the best-bet editor! But if you look in the database, it is stored as an “HTTP” URL! If you need to enter the same URL and the same title, then you can just select it in the editor using the “select existing best bet”.
Sometimes, and I haven’t been able to reproduce this since SP2, but you can get a duplicate URL into the database somehow, using the Best Bet edit screen. I think it has to do with assigning a best bet URL to multiple keywords, deleting it from the ‘first’ keyword, and then re-entering it again manually, which confuses MOSS. Anyway, you might get an error message which prevents you from editing or removing that URL from the keyword. You can delete the keyword and start over to resolve it, or you can edit the db entry for that keyword (WARNING: SharePoint … Database … DO NOT … Yadda, Yadda, Yadda, I know) and point to another URL instead, then open up the edit screen again and you will get no error. I haven’t had any problems editing any SSP database tables data directly, but YMMV.
We don’t want to build custom application using the SharePoint object model, because we don’t have access to the MOSS server directly, so we got read only access to the database that contains the SSP datastore. I have build a shiny little Windows Forms application that looks into the ssp database, READ ONLY (WARNING: SharePoint … Database … DO NOT … Yadda, Yadda, Yadda, I know).
MOSS doesn’t really give us a very good interface for managing Keywords and Best Bets where the URL is 404’d! I have about 1200 or so URLs to manage through my keywords management tool (Top-Level-Site: Site Actions –> Site Settings –> Modify All Site Settings –> Search Keywords), so I created my own tool that goes through all 1200 or so URLs and looks for 404 errors, Business mis-categorizations, and other things. I probably won’t release to codeplex, as I an just a beginner with .NET, and it has a lot of Business Process hard-coded in it.
I’ve managed to find the tables and relationships, etc etc, and build this little application that lists all of the Best Bet Titles, URLs, what the parent keyword is (and working on a list of synonyms to add to a custom report that can be spit out), who the owner is, expiry date, description, and review date. The custom app runs the URL and title through some checking (we format our Best Bet URL titles with a category, then a title, so that we can see what the link goes to). It also checks the URL and if the application gets a 404, well we know to contact the owner and get a new best bet set up.
Here is the Query that will get a good generic view of the data:
SELECT DISTINCT MSSSpecialTerms.Term, MSSSpecialTerms.Definition, MSSSpecialTerms.Contact, MSSSpecialTerms.ReviewDate, MSSSpecialTerms.StartDate, MSSSpecialTerms.EndDate, MSSBestBets.Title AS BestBetTitle, MSSBestBets.Title AS BestBetDescription, MSSBestBets.Url AS BestBetURL, MSSBestBetsLink.[Order] AS BestBetSortOrder, (SELECT Term + ‘; ‘ FROM MSSSynonyms WHERE MSSSynonyms.SpecialTermID = MSSSpecialTerms.SpecialTermID ORDER BY Term FOR XML PATH(”) ) AS OtherSynonyms
FROM MSSBestBets INNER JOIN MSSBestBetsLink ON MSSBestBets.BestBetID = MSSBestBetsLink.BestBetID INNER JOIN MSSSpecialTerms ON MSSBestBetsLink.SpecialTermID = MSSSpecialTerms.SpecialTermID INNER JOIN MSSSynonyms ON MSSSpecialTerms.SpecialTermID = MSSSynonyms.SpecialTermID
ORDER BY MSSSpecialTerms.Term, BestBetSortOrder