Searching Content Management Server with SharePoint without using the content integration pack
A while ago Emmanuel Desigaud wrote a great step by step article on how to 'Integrate SharePoint Search into a CMS Site using a Webservice'.
I had to develop a Content Management Server solution using SharePoint as the search engine and here's a brain dump of the order to do things etc.
- When Authoring your navigation / aggregation controls be sure to prevent them from showing when the User-Agent is "MS Search"
- Do this from the beginning!
- Setup a helper class and call a shared method
- Public Shared Function ShowNavigationControls() As Boolean
Return (HttpContext.Current.Request.Headers("User-Agent").IndexOf("MS Search") < 0)
End Function
- Don't bind your navigation controls & don't display them when the result is false.
- Setup a 'Crawl Page' similar to Stephen Huen's CMS Crawl Page article
- I used a similar approach but the system that I am developing won't have thousands-and-thousands of pages so I created 1 posting called "SiteMap_Crawl" using its own template.
- On this template I looped recursively through the channels & postings from the root channel -> outputting all the Published URL's as Hyperlinks.
- This page had a ROBOTS meta tag of NOINDEX, FOLLOW; so the links were followed by not indexed.
- on the footer of the homepage I added a hyperlink to the SiteMap_Crawl with a style="display:none"; so the link was on the bottom of every page (you could also only output the link if ShowNavigationControls (see above) was FALSE so the link would only be visible to the MS Search agent.
- Configure the SharePoint Search content sources & index as well Emmanuel's article.
- I then created a few user controls
- Search Input
- Plain Textbox & Search Button & a checkbox for "only search this area"
- The event on the search button found the search results control from the page by ID (or redirects to the same page with ?search= Server.UrlEncode(theSearchString) ) and bound the search results.
- Search Results
- Adds the 'search' value to a session variable so I can display the users 'recent searches'
- Simple procedure that generates the WebDav query
- It calls the http://sharepointserver/_vti_bin/search.asmx web service and gets back a DataSet.
- I then bound the dataset to a paged datagrid
- Also check if ?search=Your Search Text exists and if it does and there isn't a postback execute the search using this text as the input.
- Show Users Recent Searches
- Check if the session variable exists for the Users recent searches
- Bind a datalist to output all the users recent search results (upto the last 10)
- Each recent search uses a link back to Search.htm?search= the recent search
Posted
Oct 03 2004, 09:13 PM
by
anguslogan