Populates collections with indexed data.

The <cfindex> and <cfsearch> tags encapsulate the indexing and searching utilities.

Collections can be populated from text files in a directory you specify, or from a query generated by a query.

Before you can populate a collection, you must create the collection using either the <cfcollection> tag or the Lucee Administrator.

Use <cfsearch> to search collections populated via cfindex.

This tag cannot have a body.

This tag is also supported within <cfscript>

<cfindex name=string collection=string action=list|update|delete|purge|refresh type=string title=string key=string body=string custom1=string custom2=string custom3=string custom4=string urlpath=string extensions=string query=string recurse=boolean external=boolean language=string category=string categorytree=string status=string prefix=string timeout=number throwontimeout=boolean >
Attribute Description
string, optional

name of the variable generated by action "list" to return the query containing all indexes of a collection.

Alias: variable

string, required

Specifies a collection name. If you are indexing an external collection external = "Yes", specify the collection name, including fully qualified path.

string, required

Specifies the index action.

string, optional

Specifies the type of entity being indexed. Default is CUSTOM.

string, optional

Title for collection; Query column name for type and a valid query name; Permits searching collections by title or displaying a separate title from the key

string, optional
  • Absolute path and filename, if type = "file"
  • Absolute path, if type = "path"
  • A query column name (typically, the primary key column name), if type = "custom"
  • A query column name, if type = any other value

This attribute is required for the actions listed, unless you intend for its value to be an empty string.

string, optional
  • ASCII text to index
  • Query column name(s), if name is specified in query

You can specify columns in a delimited list. For example:

  • emp_name, dept_name, location"
string, 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.

string, optional

A custom field you can use to store data during an indexing operation. Usage is the same as for custom1.

string, optional

A custom field you can use to store data during an indexing operation. Usage is the same as for custom1.

string, optional

A custom field you can use to store data during an indexing operation. Usage is the same as for custom1.

string, 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.

string, optional

Specifies the comma-separated list of file extensions that Lucee uses to index files if type = "Path". Default is HTM, HTML, CFM, CFML, DBM, DBML. An entry of "*." returns files with no extension

string, optional

Specifies the name of the query against which the collection is generated.

boolean, optional

Yes or No. Yes specifies, if type = "Path", that directories below the path specified in key are included in the indexing operation.

boolean, optional

This attribute has been deprecated and is non-functional.

* deprecated *
string, optional

language used to index

string, optional

A string value that specifies one or more search categories for which to index the data. You can define multiple categories, separated by commas, for a single index.

string, optional

A string value that specifies a hierarchical category or category tree for searching. It is a series of categories separated by forward slashes ("/"). You can specify only one category tree.

string, optional

The name of the structure into which Lucee returns status information.

string, optional

Specifies the location of files to index when the computer that contains the K2 Search Service is not the computer on which you installed Lucee, and when you index files with the type attribute set to path.

* unimplemented *
number, optional

the timeout in seconds for a single request of type url

boolean, optional

Specifies how timeout conditions are handled. If the value is true, an exception is generated to provide notification of the timeout. If the value is No, execution continues. Default is no.

* unimplemented *


Syntax for cfindex

<cfindex collection="collection_name" action="list" name="test_index" type="path" urlpath="#filepath#" extensions=".cfm,.cfc,.pdf,.docx">

See also