Example2 Categories

This example shows how to assign documents in the index to Content and Location categories

For details on Content and Location categories, please see the"Assigning Content And Location Categories" section of the Help documentation.


We will;
1. Create Content/Location categories
2. Automatically assign Location categories
3. Configure SearchBoxOptions control

1. Create Content/Location categories

From the page containing the SearchResult control (Example2_Categories/SearchResults.aspx in our example), access the Index Management Tool and select the Location/Content form.

In the Name field, enter the title for the Content/Location category and select the Add Content/Location button.

URLs can then be manually assigned by dragging them from the default category to the Content/Location categories as required.

2. Automatically assign Location categories

Existing and newly imported URLs can be automatically assigned to Location categories. Using the Index Management Tool select the Location form. Select an existing Location category, or create a new category, and in the Location Root field enter string used to identify document URLs which will be automatically added to this category (such as the a folder name).

To assign existing URLs select the Location category and click Assign Locations.

Any future imported documents that meet the location criteria will be automatically assigned for you.

For example, we have set the Location Root for the Policies category to /Policies/. Allowing the user to only search documents located within that category.

3. Configure SearchBoxOptions control

To display the Content and Location category options to the user the SearchBoxOptions control should be added to the page containing the SearchBox control. Set the SearchBoxId property to the ID of the SearchBox control.

Under the Content/Location property of the SearchBoxOptions control, enter the category names previously created. Note: These must match the exact titles specified when you created the categories, otherwise, as default, all categories will be searched.

Introduction