Wednesday, December 1, 2010

Sharepoint 2007 Search

I have been working on SharePoint 2007 search for quiet some time now, but i remember whenever i had an issues i had too look all over the web for finding solution. So thought of consolidating those search items, so that anyone can find search related features at one consolidating location.

Whenever there is a requirement for implementing search in any of the projects. Two important queries comes into my mind:
1. Whether this can be achieved using OOB search?
2. Is this the best fit for custom search (search using API's).

So broadly search implementation could be categorized in 2 categories:
  1. OOB Search (Out of Box search has rich set of functionality, and is the best option while implementing search).
  2. Custom Search using SharePoint API's (There will be scenerios where OOB search doesn't always suffice the requirements and custom code needs to be written).

Out Of Box Search:
SharePoint has rich set of inbuilt functionalities and is a huge leap from earlier versions of MOSS.
Learning OOB Search capabilities involves knowledge of 2 parts:
  • Search webparts
  • Search configuration in Central Admin
Search webparts
Sharepoint consists of following webparts:
  1. Search Box Webpart: This webpart provides the textbox for inserting search keyword and scope dropdown within which search needs to be performed. Scope dropdown lists the different scope values and these values keeps on changing depending upon the page user is on i.e. by default it will have a scope of searching within the site, but when the user navigates to some list/library page it will display an additional value of searching within that list.
  2. Search Summary Web part: This webpart provides the Did you mean functionality.
  3. Search Actions Links webpart: This webpart provides functionality of sorting the search results by Relevance or Modified Date. It also facilitates subscription to blogs or Alert Me functionality on search keyword.
    "This webpart does not facilitate customization or addition of new links"
  4. Search Best Bets webpart: This webpart provides flexibility to admin for providing the recommended search results section when a particular keyword(s) is searched.
    • Configuration of Best Bets against set of keyword(s) can be done within the search configuration settings available in Site Collection Administration section on Site Settings page.
    • Xslt of this webpart can also be customized to show certain set of fields or formatting the results. " Though you cannot add any additional fields to be displayed apart from what are predefined within Best Bet settings section"
    • "This is a sealed webpart so you cannot extend this webpart either".

  5. Search Statistics webpart: Displays statistics such as the number of results shown on the page, the total amount of results, and the time it took to execute the search query.
    "Not much customization possible within this webpart apart from text to be displayed"
  6. Search Paging webpart : Displays page links on the search results page, used for navigating to search pages back and forth.
  7. Search Core Results webpart: This is the most important webpart in search results. This webpart is used to display the actual search results. Thanks to MS, this webpart is highly customizable and configurable:
    • Propertied to configure searching and default sorting.
    • Options for tuning the results query. Duplicate results can be displayed or hidden from the user.
    • Stemming can be enabled or disabled.
    • Enable or disable noise word queries.
    • SelectColumns helps in fetching custom columns within search results.
    • XSLT can be customized enabling formatting of search results.
I will try to accomodate customized search features and search setting features in additional posts

Additional Resources for Search webparts:
http://msdn.microsoft.com/en-us/library/bb608302%28office.12%29.aspx

Wednesday, November 24, 2010

Sharepoint naming site collection url

Few days back we got the requirement from one of our clients that he want a new site collection on our sharepoint environment.
We have already provisioned a set of web applications (which are mapped to DNS) and we typically do provision a site collection for different teams depending upon their requirements.

But in this case client wanted that this new site should be identifiable by a unique domain name.
i.e. our existing web application had url http://webapps1.com and typically all site collections have url's of format http://webapps1.com/sites/xyz.
But in this case client wanted the site should be called http://xyz.com

So I did some exploration on achieving this functionality and found following options:
  1. Making a new webapplication on port 80 and host this new site as root site collection. In this way we could facilitate mapping of different domain names to web applications hosted on same server.This method seemed easiest but it had its flaws. It meant that everytime this type of requests comes we will have to create a new webapplication for each small site which inturn could put a lots of overhead (load/supportablity etc) on the server and its performance.
  2. Creating a redirect site in IIS, means creating a dummy site within IIS called http://xyz.com. Map this site in DNS and within IIS redirects this site to actual site http://webapps1.com/sites/xyz. Even this approach had similar issues (server overhead/supportablity etc.).
  3. Then i thought of using Alternate Access Mapping (AAM) which we used within our last application for provisining internal and external site, but then found that AAM works only at web application level.
  4. Then i zeroed upon a concept called Host Named Site Collections. With this approach while creating each of the site collections we can give host header to each of the site collection. Only flaw of this approach is that everytime you need to create a host named site collection then that needs to be done using stsadm command line utility. Ref: http://technet.microsoft.com/en-us/library/cc424952(office.12).aspx
Bingo this is what i was looking for. Microsoft did think through all the possible requirements which might arise before developing any product. Kudos to MS for this.
This also left me with the answer that MOSS platform itself has a lot of capabilities inbuilt and lot still needs to be explored even after working with it for so many years.

Sharepoint 2007 site Stsadm issue

Yesterday we found an interesting stsadm command issue while resolving "Sharepoint 2007 site (HTTP 403 Forbidden error)" error on our machine.

Problem Statement:
We have started getting 403 forbidden error on our moss site. This site was working perfectly since months and no changes have been done on site since last month.
As a result all the sites within this application pool (ABC.com, stopped working.

We tried digging into the IIS logs/moss logs, but have not found anything as if now.
Interestingly web.config on this site got modified automatically it was missing moss sections like "BlobCache", i restored the previous version of file with all the sections, but to no avail.

Then we thought of possibility of some other service pack which hosting team might hv deployed on server,but strangely aour other application deployed on same server within different application pool XYZ.com is working perfectly.


Issue:
After doing lots of research we discovered an interesting finding.
One of the admin was running stsadm command for uninstalling one of the features on the site.
Somehow before completing the command, enter key got pressed and unfinished command got executed, which did some stuff within content database.
As a result above mentioned error came up.


I tried exploring documentation of MS and over the net to find out of the possible impact, but couldn't find one.
As a result i went ahead and executed this command "-o uninstall" on 1 of our dev machines.
Interestingly all the sites/webapplications hosted on <80> virtual directory stopped working.
When i tried to locate the files (web.config,dll's etc) in this virtual directory i could not find one.

That means this command deleted all virtual directories hosted on port 80 and corresponding databases.

So please execute this stsadm command with utmost care.