860.255.8324

P.O. Box 156
Terryville, CT 06786-0156

Enabling SharePoint search to crawl custom columns with managed properties

Consider this scenario – you have a large amount of data contained within MOSS, with a column specified to contain some form of metadata for the purpose of tagging your data.  You wish to enable easy searching capability for your data, refining the search to the possible values of your tags. 

In order to satisfy this requirement, you will need to perform a few important steps to prepare.  

Within MOSS’s Shared Services Administration: 

  • Click “Search Settings”
  • Click “Metadata property mappings”
  • Click “New Managed Property”
  • Enter a name for your property – this is the friendly name you’ll use later to refine your search.  In my case, I’m refining to a column called “Service”, so I’ll simply name this property “Service”
  • Choose the type of information this property will refer to.  In my case, it is of the value type “Text”
  • Select your mapping to crawled properties.  I chose “Include values from all crawled properties mapped” which will attempt to match our managed property to any of the crawled properties we select.  In essence, this allows us to search for our value in more than one column.  We’ll just select one crawled property for now.
  • Click “Add Mapping” to select your crawled property.  MOSS automatically searches all columns that you add, to any list.  Simply search through and find the column with the same name as yours.  Note: You may find that the column is prefixed with “ows_”, that’s okay.  Also remember, if your column contains a space, MOSS will have that space replaced with the _x0020_ code which is a MOSS standard for a space.  In my case, my crawled property is listed as ows_Service(Text)
  • You can optionally select “Allow this property to be used in scopes”.  We won’t be using this for this case, so leave it unchecked.  What this would allow if it were checked, is to allow us to set up some rules which can be used in the search scope dropdown list within MOSS.
  • Click “OK”

You will now need to dump your search index and perform a full crawl of your content sources.  If you forget to dump the index, you’ll end up with duplicate search entries for each item in MOSS. 

  • Back on the “Search Settings” page, click “Reset all crawled content”
  • Ensure the “Deactivate search alerts during reset” checkbox is checked.  This will prevent users from getting new content notifications when the index is rebuilt.
  • Click “Reset Now”
  • Now, back on the “Search Settings” page, click “Content sources and crawl schedules”
  • On this page, “Manage Content Sources”, activate the drop down menu for your content source, and choose “Start Full Crawl”.  If you have more than one content source, you will need to do this for each.

Once the full crawl has completed, you can go back and view your managed property to confirm it worked.  On the details page for your managed property, MOSS displays the number of items detected with respective content. 

Now that we have our new managed property, we can test it.  Simply go to any search box in MOSS and perform a search for your property name and value to search delimited by a colon.  For example, with my implementation, I can try Service:Internet which will return all items which have the service tag of “Internet”.  If everything is set up correctly, you should see search results.  Keep in mind that it could take several hours for your search index to rebuild by performing a full crawl. Also, if the value you’re looking for includes a space, be sure to place quotes around it. Example: Service:”Corporate Intranet” 

Now, lets build a custom search, javascript “web part”, and results page.  Choose a place within MOSS where you would like to store these two web part pages.  I put them in a document library within our “Support” site.  One is named “CustomSearch.aspx”, and the other “SearchResults.aspx”.  In the Search Results page, add three web parts.  Search Statistics, Search Core Results, and Search Paging.  Technically only the Search Core Results web part is required, but the additional data obtained from the other two web parts may prove quite useful. 

Now, lets set up our CustomSearch.aspx page.  On this page, add a Content Editor Web Part.  These web parts allow us to add our own html content.  We will use some custom html and JavaScript to help users format their searches.  I chose to have three components for my custom search: keywords, type of document, and service type.  The following javascript and html provides those input fields, with and the necessary script to redirect to our SearchResults.aspx page: 

<table>
 <tr>
<td>Keyword(s):</td>
<td><input name=”input1″ /></td>
</tr>
<tr>
<td>Type:</td>
<td>
<select id=”input2″>
<option value=”" title=”">Any</option>
<option value=”Announcement” title=”Announcement”>Announcement</option>
<option value=”FAQ” title=”FAQ”>FAQ</option>
<option value=”General Document” title=”General Document”>General Document</option>
<option value=”Hotfix” title=”Hotfix”>Hotfix</option>
<option value=”How To” title=”How To”>How To</option>
<option value=”Known Issue” title=”Known Issue”>Known Issue</option>
<option value=”Item” title=”Item”>Item</option>
</select>
</td>
</tr>
<tr>
<td>Service:</td>
<td>
<select id=”input3″>
<option value=”CIM” title=”CIM”>CIM</option>
<option value=”Compass” title=”Compass”>Compass</option>
<option value=”Email” title=”Email”>Email</option>
<option value=”Employee Directory” title=”Employee Directory”>Employee Directory</option>
<option value=”iLinc” title=”iLinc”>iLinc</option>
<option value=”Intranet” title=”Intranet”>Intranet</option>
<option value=”Phone/conferencing/fax and wireless devices” title=”Phone/conferencing/fax and wireless devices”>
Phone/conferencing/fax and wireless devices</option>
<option value=”Procurement Services” title=”Procurement Services”>Procurement Services</option>
<option value=”TFS” title=”TFS”>TFS</option>
<option value=”VPN” title=”VPN”>VPN</option>  

</select>&nbsp;<input id=”Submit1″ onclick=’Redirect(form.input1.value, form.input2.value, form.input3.value)’ type=”button”
name=”schButton” value=”Search” />
</td>
</tr>
</table> 

  

<script language=”javascript”>
function Redirect(keywords, type, service) {
//Location where you want to display the
//search results. There must be at least a core search results web part on this page.
var baseURL = “SearchResults.aspx?k=\”" + keywords + “\”%20ContentType%3A” + type + “%20Service%3A” + service
top.location.href = baseURL;
return true;
}
</script> 

Simply add this code to the source editor view of the Content Editor Web Part, and save your changes. That’s it!  You should now have a search system, refinable to the columns of your choice.

Jayson
View all posts by Jayson
Jayson's website
  • http://blog.shortwaves.org shortwaves

    hello, nice post there. i’m following it and it ferfectly working, but i’m asking about : how can i delete the columns “Description” and “Key Words” from Image template?