SharePoint Search and RTF File Indexing


Found out today while answering a #SPHelp question for my buddy Eric Harlan, that SharePoint 2010 does not natively index RTF files, it requires an iFilter.

Luckily, there is an easy answer to it, which came back in a Google Books preview of Pro SharePoint 2010 Search. Click the link for details –

I also learned that FAST search does however index RTF files by default, thanks to @NauplisTrevor


The good news is – you can still learn something new every day! And by all means, if you do learn something new about SharePoint, share it with the rest of the world by blogging, tweeting, or, the old school method of writing it in sidewalk chalk on your driveway (you may want to put a tarp over it if it rains however, as it will wash away. I found this out the hard way…).


Stay away from my search result pages [insert search engine name here] bot!!

imageNow, this is a bit overkill, but, there are almost as many different ways a search crawler makes use of a robots.txt file as there are search engines (this may be highly over-exaggerated, but anyways…).

Now, one thing you probably do not want with your public facing site, is for the search engine to waste it’s time crawling your search pages. You don’t exactly want a high page rank for your site’s search results, do you?

What to do, what to do?

Well, if your search results pages happen to live under /search/pages/results.aspx, here is an example. This again is a bit overkill, but it should get the job done. Now the search engines can focus on what you want to be getting searched for – your content!

Some search bots allow for wildcards, some are case insensitive, some are case sensitive – hence the number of variations below. Add this into your robots.txt, and you should be good to go.

Disallow: /search/pages/results.aspx
Disallow: /Search/Pages/Results.aspx
Disallow: /Search/Pages/results.aspx
Disallow: /Search/pages/Results.aspx
Disallow: /search/Pages/Results.aspx
Disallow: /search/pages/Results.aspx
Disallow: /Search/pages/results.aspx
Disallow: /search/Pages/results.aspx
Disallow: /search/
Disallow: /Search/
sallow: /search/pages/
Disallow: /Search/Pages/
Disallow: /Search/pages/
Disallow: /search/Pages/
Disallow: /*Results.aspx
Disallow: /*results.aspx

Any additions? Please share them here in the comments!

Hiding the Search Scopes Drop-Down in WSSv3/MOSS 2007

In WSS v3 and MOSS 2007, you may be inclined to hide the search scopes drop-down control from a specific page. This article will tell you how to do just that. While this may translate to 2010, I have not tried it as of this point.

What is this ‘Search Scopes’ control you speak of?
The Search Scopes drop-down control you will find to the left of the search box in SharePoint by default. If you are running WSS, or have this on a team site, you will generally see this populated, depending on your location, with the default for that page. Such as here, from the main page of this blank site template, it defaults to the “scope” of the site This Site: My Company (below).


If you drill down into a list, you will see this change, it is contextual in WSS, so it will by default, from a list page, default to the “scope” of just the list, as the example shows below, This List: My Generic List


But since that list is contained within the My Company site, you will see, you can drop the search box down to search not only the list, but also the site as well.


I don’t think I need to mention that depending on the scope you select, your search will execute against that search scope.

In MOSS 2007, or using Search Server Express on top of WSS, you will see your search scopes include whatever scopes have been defined at the Shared Service Provider level, in addition to the contextual WSS searches (This Site, This List), as shown below. The All Sites and  People searches are two default scopes in MOSS 2007 search.


Those scopes are configurable within the Shared Service Provider, and will only search on whatever content was configured for those scopes, so we will not get into all those possibilities, we’re just talking about hiding some part of the page here.

Ok, now that you’ve enlightened me on this “Search Scopes” control, how do I hide it?
Well, I am glad you asked, seeing as that is the point of the entire article! To hide it, we need to locate the control, and then toggle its visibility. First, lets view the page source, and see if we can find it. We know that the drop-down box contains the text This Site: My Company, so, lets search for that.


Now that we have located it, lets move back a bit from that control, and see if we can find the ID of the select box, or the ID of the cell in which it is contained, so we can hide it with just CSS.

NOTE: I know what some of you are thinking “Use Firebug!”, and “Use the IE Developer Toolbar!”. I know these are options people, but, I’m going for simple here. Lots of people have notepad, and lots of people know how to use that.

The following code contains the select control, as well as the surrounding table cell.

   1: <td class="ms-sbscopes ms-sbcell">
   2:     <select name="ctl00$PlaceHolderSearchArea$ctl01$SBScopesDDL" 
   3:         id="ctl00_PlaceHolderSearchArea_ctl01_SBScopesDDL" 
   4:         title="Search Scope" 
   5:         class="ms-sbscopes">
   6:             <option selected="selected" value="This List">This List: My Generic List</option>
   7:             <option value="This Site">This Site: My Company</option>
   8:     </select>
   9: </td>

If we look at this, the ID contains some dynamically generated stuff (ct100$blahblahblah$ct101), as does the name. Both are generated dynamically, so we should ignore those. We need something a bit more solid to land on, that is not going to change. That basically leaves us with the titles, as well as the classes of the search scopes drop-down box.

NOTE: Granted – when looking at a sampling of team sites on multiple local development images that I have, the control is the same within the code. However, I am going with something a bit more stable, the default styles that are attached to the TD surrounding the SELECT drop-down control.

I’m personally going to aim for the table cell (TD) which surrounds the select control, and hide that away. Your mileage may vary, you may want to go after the select control itself, and leave the table cell there.

So, with the table cell, we have no ID, we have no title, just the two classes, ms-sbscopes and ms-sbcell. How do we find the table cell with that? Magic? Voodoo? Increased taxes to the IRS? No, my dear friends, JavaScript. The frustrating client side scripting language of those who practice the martial art of SharePoint-fu.

Unfortunately I do not have the source readily available from where I found this code, it was quite a while ago when it found its way from the interwebs into my javascript toolkit, but, this is the code to get it done.

   1: <script type="text/javascript">
   2: document.getElementsByClassName = function(){
   3:     if(document.hasChildNodes && arguments[0]){
   4:         var data = new Array();
   5:         for(a=0;a<document.getElementsByTagName("*").length;a++){
   6:             if(document.getElementsByTagName("*")[a].className == arguments[0]){
   7:                 data.push(document.getElementsByTagName("*")[a]);
   8:             }
   9:         }
  10:         return data;
  11:     }
  12: }
  13: document.getElementsByClassName("ms-sbscopes ms-sbcell")[0].style.display = "none";
  14: </script>

What this does is locates the element, in this case, the TD, by it class names, and then allows us to work with it, in this case, setting the display style to “none”, hiding it, but not deleting it from the page (see below), so when a search is executed, the default selected search scope is used to fire off the search.

document.getElementsByClassName("ms-sbscopes ms-sbcell")[0].style.display = "none";

How do you use this? Well, you can drop it into a Content Editor Web Part, into the Master Page, etc. Once done, the search scopes drop-down should disappear from sight.


%d bloggers like this: