Wednesday, December 28, 2011

Adding metadata properties in advanced search

While we were working with search, we created hiererchy, we created managed metadata properties and added refinements to our search on basis of those managed metadata properties.
Now, we want the same metadata properties in our advanced search. How to customise the advanced search webpart to view our metadata properties.

1. Go to the advanced search page, click on edit page
2. Click on 'Edit web part' on the Advance search box web part.
3. Expand the properties section.
4. Copy the xml in the properties section, paste to xml editor or visual studio.
5. Collapse all nodes.The last two nodes are the ones which we have to change.
6. First is the propertydefs node.
7. Copy and paste the below line in the property defs tag -
PropertyDef Name="Department" DataType="text" DisplayName="Department"
8. Now go to the 'ResultTypes' node and paste the below line in each section - PropertyRef Name="Department"
9. This line should go in all the sub sections of 'ResultTypes'.
10. Copy this xml and paste in the properties section of the web part.
11. Click on OK and come out of edit.

You will see the property as below in the advanced search section:

Tuesday, December 27, 2011

Redirect to custom search page instead of OSSSearchResults.aspx

While setting up search, we create a seperate search site. On this site, on the results page, we can set up any customizations we want. We can modify the xslt, set up refinements etc. On our default master page, the search box redirects us by default to the osssearchresults.aspx page. But, we want to be redirected to our custom search page.

A simple way to achieve this is to go to your site Collection, go to site settings - Under Site Collection administration, choose 'Search Settings'. On this page change the 'Site Collection Search Results Page' to 'http://.../search/results.aspx' or whatever is your custom search page.

Friday, December 2, 2011

Find feature name from id

There have been several cases, where I am trying to deploy something and it gives me an error saying 'Dependency of the below feature' etc. The error message just gives me a Feature Id. How to find out the name of the feature given the feature id.
The simplest way is to query the content database. Go to the database server of your sharepoint installation and type the below command:

use wss_content
select * from FeatureTracking where FeatureId like '8%'

Here feature id is the one in the error you are getting. You will get all the details of your feature. Use the content database of your particular web application.