<cfindex>
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 |
|---|---|
name
string, optional
|
edit
name of the variable generated by action "list" to return the query containing all indexes of a collection. Alias: variable |
collection
string, required
|
edit
Specifies a collection name. If you are indexing an external collection external = "Yes", specify the collection name, including fully qualified path. |
action
string, required
|
edit
Specifies the index action. |
type
string, optional
|
edit
Specifies the type of entity being indexed. Default is CUSTOM. |
title
string, optional
|
edit
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 |
key
string, optional
|
edit
This attribute is required for the actions listed, unless you intend for its value to be an empty string. |
body
string, optional
|
edit
You can specify columns in a delimited list. For example:
|
custom1
string, optional
|
edit
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
string, optional
|
edit
A custom field you can use to store data during an indexing operation. Usage is the same as for custom1. |
custom3
string, optional
|
edit
A custom field you can use to store data during an indexing operation. Usage is the same as for custom1. |
custom4
string, optional
|
edit
A custom field you can use to store data during an indexing operation. Usage is the same as for custom1. |
URLpath
string, optional
|
edit
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
string, optional
|
edit
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 |
query
string, optional
|
edit
Specifies the name of the query against which the collection is generated. |
recurse
boolean, optional
|
edit
Yes or No. Yes specifies, if type = "Path", that directories below the path specified in key are included in the indexing operation. |
language
string, optional
|
edit
language used to index |
category
string, optional
|
edit
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. |
categoryTree
string, optional
|
edit
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. |
status
string, optional
|
edit
The name of the structure into which Lucee returns status information. |
timeout
number, optional
|
edit
the timeout in seconds for a single request of type url |
Unimplemented Attribute(s)
| Attribute | Description |
|---|---|
external
boolean,
optional
|
edit
This attribute has been deprecated and is non-functional. * deprecated * |
prefix
string,
optional
|
edit
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 * |
throwontimeout
boolean,
optional
|
edit
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 * |
Examples
editSyntax for cfindex
<cfindex collection="collection_name" action="list" name="test_index" type="path" urlpath="#filepath#" extensions=".cfm,.cfc,.pdf,.docx">
See also
- Search
- Lucene 3 Extension
- <cfcollection>
- <cfsearch>
- Lucee uses Apache Lucene for full text indexing
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)