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:

No comments:

Post a Comment