cfindex

Description

Populates collections with indexed data. The cfindex and cfsearch tags encapsulate the Verity indexing and searching utilities. Verity collections can be populated from text files in a directory you specify, or from a query generated by a ColdFusion query. Before you can populate a Verity collection, you must create the collection using either the cfcollection tag or the ColdFusion Administrator. Use cfsearch to search collections you populate with cfindex.

Category

Extensibility tags

Syntax


<cfindex collection = "collection_name"

  action = "action"

  type = "type"

  title = "title"

  key = "ID"

  body = "body"

  custom1 = "custom_value"

  custom2 = "custom_value"

  URLpath = "URL"

  extensions = "file_extensions"

  query = "query_name"

  recurse = "Yes" or "No"

  external = "Yes" or "No"

  language = "language"> 

See also

cfcollection, cfexecute, cfgraph, cfobject, cfreport, cfsearch, cfservlet, cfwddx

Attributes

Attribute
Description
collection
Required. Specifies a collection name. If you are indexing an external collection (external = "Yes"), specify the collection name, including fully qualified path:

collection = "e:\collections\personnel" 

You cannot combine internal and external collections in the same indexing operation.
action
Optional. Specifies the index action. Valid entries are:
  • update    Updates the index and adds the key specified in key to the index if it is not already defined.
  • delete    Deletes the key specified in key from the specified collection.
  • purge    Deletes data from the specified collection, leaving the collection intact for re-population.
  • refresh    Clears data in the specified collection before re-populating.
  • optimize    Optimizes the specified collection of files. This action is deprecated; use cfcollection instead.
type
Optional. Specifies the type of entity being indexed. Default is CUSTOM. Valid entries are:
  • file    Indexes files.
  • path    Indexes all files in specified path that pass extensions filter.
  • custom    Indexes custom entities from a ColdFusion query.
title
Required if type = "Custom". Specifies one of the following:
  • A title for the collection
  • A query column name for type and a valid query name
The title attribute allows searching collections by title or displaying a separate title from the actual key.
key
Optional. A unique identifier reference that specifies one of the following:
  • Document filename, if type = "file"
  • Fully qualified path, if type = "path"
  • A unique identifier, if type = "custom", such as the table column that holds the primary key
  • A query column name for any other type argument
body
Optional. ASCII text to index or a query column name. Required if type = "Custom". Ignored for type = "File" and type = "Path". Invalid if type = "delete". Specifies one of the following:
  • The ASCII text to be indexed
  • A query column name if a query name is specified in query
Multiple columns can be specified in a comma-separated list:
body = "employee_name, dept_name, location"

custom1
Optional. A custom field you can use to store data during an indexing operation. Specify a query column name for type and a query name.
custom2
Optional. A custom field you can use to store data during an indexing operation. Usage is the same as for custom1.
URLpath
Optional. Specifies the URL path for files if type = "file" and type = "path". When the collection is searched with cfsearch, the pathname is automatically be prepended to filenames and returned as the url attribute.
extensions
Optional. Specifies the comma-separated list of file extensions that ColdFusion uses to index files if type = "Path". Default is HTM, HTML, CFM, CFML, DBM, DBML.
An entry of "*." returns files with no extension:
extensions = ".htm, .html, .cfm, .cfml, *."

This example returns files with the specified extensions, and files with no extension.
query
Optional. Specifies the name of the query against which the collection is generated.
recurse
Optional. Yes or No. Yes specifies, if type = "Path", that directories below the path specified in key are included in the indexing operation.
external
Optional. Yes or No. Yes indicates that the collection specified in collection was created outside of ColdFusion using native Verity indexing tools.
language
Optional. To use the language attribute you must have the ColdFusion International Search Pack installed. Valid entries are:
  • English (default)
  • German
  • Finnish
  • French
  • Danish
  • Dutch
  • Italian
  • Norwegian
  • Portuguese
  • Spanish
  • Swedish

Example

<!--- This example shows how to utilize cfindex

to populate an existing collection with content --->

<html>

<head>

<title>

cfindex Example

</title>

</head>

<body bgcolor = silver>

<H3>cfindex Example</H3>



<!--- To index the collection, select the check box on the form --->

<cfif IsDefined("form.IndexCollection")>

<cfindex action = "update" collection = "Snippets"

  key = "c:\inetpub\wwwroot\cfdocs\snippets" type = "path" 

    title = "Test"

  URLpath = "http://127.0.0.1/cfdocs/snippets/" 

  extensions = ".cfm" recurse = "Yes">

...



Banner.Novgorod.Ru