Friday, December 17, 2010

Configuring Advanced Search to use Managed Properties

    Step 1: Create managed properties

    Use the following procedure to create managed properties.

    1. Go to SharePoint Central Administration.  Select Application Management, and in the left hand bar Under Shared Services Administration click on your Shared Services website (e.g. SharedServices1)
    2. On the Shared Services Administration page, in the Search section, click Search settings.
    3. On the Configure Search Settings page, in the Crawl Settings section, click Metadata property mappings. Check to see if your property already exisits.  if so, you are good to go. if not, proceed to step 4.
    4. On the Metadata Property Mappings page, click New Managed Property.
    5. On the New Managed Property page, in the Name and type section, in the Property name box, type the name of the managed property you want to create.
    6. In the Description box, type a description for this managed property.
    7. Under The type of information in this property, select a property type.
    8. In the Mappings to crawled properties section, select one of the following:
      • Include values from all crawled properties mapped. Select this option if you want values from all crawled properties to be mapped. A query for a property in a document in which all crawled properties are mapped returns a result if any of the crawled properties that are mapped match the query.
      • Include values from a single crawled property based on the order specified. Select this option if you want only a single value mapped. When multiple crawled properties are mapped to a managed property, the one that is chosen will be the first in the list that has a value for a given document. You can reorder the list by using the Move up and Move down buttons.
    9. If you selected Include values from all crawled properties mapped, skip to step 12.
    10. Click Add Mapping to add a mapping to the list.
    11. The Crawled property selection dialog box appears. Configure the settings as follows:
        1. On the Select a category menu, click either All categories or a specific type of document category (for example, Office or SharePoint).
        2. In Select a crawled property, select a crawled property to map to the managed property that you are adding.
          Because the list of crawled properties is likely to be long, you can type the name (or the first part of the name) of the property that you are looking for in the Crawled property name box and then click Find.
        3. Click OK.
    12. Repeat steps 9 through 10 for each additional crawled property that you want to map to this managed property.
    13. On the New Managed Property page, in the Use in scopes section, select the Allow this property to be used in scopes check box if you want this managed property to be available for defining scopes.
    14. Click OK.

    Step 2: Customizing Advanced Search

    Once this is done we can now proceed to step #2 which is to modify the Advanced Search page so users will see the property. Here is a screen shot with the Advanced Search page,  at the bottom you can see that you can search based on properties.

    clip_image001

    But by default only the standard SharePoint properties are available in the search as can be seen in this screen shot.

    clip_image002

    In my case I wanted to add a property called "Defendant". This is a Site Column associated to my Liability Document Library where my Custom Content Type called "Liability Library" has many Site Columns. In order to do this I needed to modify the XML of the Advanced Search Web Part. 

    To do this.

    1. Go to the Advanced Search Web page.
    2. From the Site Actions menu select Edit Page.
    3. Select "Modify Shared Web part" from the Edit menu on the search web part.
    4. Expand the Properties section and then click on the XML in the Properties box. You should be able to expand the view of the XML by clicking on the ... button.
    5. Add the property you added in the MetaData Mapping above to both the PropertDef and PropertyRef sections of the XML.
      1. There will be 5 Entries (6 if you want it to be part of all results).
        • These sections cover the Advanced Search for Result types: "All Results, Documents, Word Documents, Excel Documents, PowerPoint Presentations".
        • Example: <ResultType DisplayName="Documents" Name="documents">
        • Note: Adding New ResultTypeDisplayName example "PDF" would add a new Result type item.
      2. 1 in PropertyDef
        • <PropertyDef Name="Defendant" DataType="text" DisplayName="Defendant"/>
      3. 4 in PropertyRef
        • <PropertyRef Name="Defendant" />

    This is the XML with my additions:

    clip_image003

    Once this is done and the web part is saved, you should be able to go back to the Advanced Search page and see your property in the list of properties available for search. 

    Now you can should be able to search based on metadata in your custom column.

0 comments: