Adobe ColdFusion 8

Indexing collections that contain categories

When you index a collection with support for categories enabled, you must do the following:

  • Specify a category name using the category attribute. The name (or names) that you provide identifies the category so that users can specify searches on the documents that the collection contains. For example, you might create five categories named taste, touch, sight, sound, and smell. When performing a search, users could select from either a pop-up menu or check box to search within one or more of the categories, thereby limiting their search within a given range of topics.
    <cfindex collection="#Form.IndexColl#"
        action="update"
        extensions=".htm, .html, .xls, .txt, .mif, .doc, .pdf"
        key="#Form.IndexDir#"
        type="path"
        urlpath="#Form.urlPrefix#"
        recurse="Yes"
        language="English"
    	category="taste, touch, sight, sound, smell">
    

  • Specify a hierarchical document tree (similar to a file system tree) within which you can limit searches, when you use the categoryTree attribute. With the categoryTree attribute enabled, ColdFusion limits searches to documents contained within the specified path.

    To use the categoryTree attribute, you specify a hierarchical document tree by listing each category as a string, and separating them using forward slashes (/). The tree structure that you specify in a search is the root of the document tree from which you want the search to begin. The type=path attribute appends directory names to the end of the returned value (as it does when specifying the urlpath attribute).

    Note: You can specify only a single category tree.

    <cfindex collection="#Form.IndexColl#"
        action="update"
        extensions=".htm, .html, .xls, .txt, .mif, .doc, .pdf"
        key="#Form.IndexDir#"
        type="path"
        urlpath="#Form.urlPrefix#"
        recurse="Yes"
        language="English"
        category="taste, touch, sight, sound, smell"
    	categoryTree="human/senses/taste">
    

For more information on using the cfindex tag to create Verity collections with support for categories, see cfindex in the CFML Reference.