Lucee Tag Reference
<cfcollection>
Allows you to create and administer search collections for indexing and searching content.
This tag enables full-text search capabilities, including hybrid vector search when used with embedding services.
Collections can be queried using different search modes: keyword-based (traditional), vector-based (semantic), or hybrid (combining both approaches).
Use this tag to manage the lifecycle of search collections that can be populated with cfindex and queried with cfsearch.
Body
This tag can't have a body.
Example
<cfcollection [action=create|repair|delete|optimize|list|map|categoryList] [categories=boolean] [collection=string] [embedding=string] [engine=string] [language=string] [mode=hybrid|keyword|vector] [name=string] [path=string] [ratio=numeric]>
This tag is also supported within cfscript
<cfscript> collection [action=create|repair|delete|optimize|list|map|categoryList] [categories=boolean] [collection=string] [embedding=string] [engine=string] [language=string] [mode=hybrid|keyword|vector] [name=string] [path=string] [ratio=numeric]; </cfscript>
Attributes
The attributes for this tag are fixed. Except for the following attributes no other attributes are allowed.
| Name | Type | Required | Default Value | Description |
|---|---|---|---|---|
| action | string | No | list | Specifies the operation to perform on the collection: |
| categories | boolean | No | When set to `true`, enables category support for the collection. Categories allow you to organize and filter documents within the collection. Only applicable when creating a new collection. | |
| collection | string | No | Specifies the name of the collection to operate on. When `action="map"`, this represents the alias name for the collection. | |
| embedding | string | No | Specifies the embedding service to use for creating vector representations of documents, enabling semantic search capabilities. Default is "TF-IDF" if not specified. This attribute is ignored when `mode="keyword"`. Valid options: |
|
| engine | string | No | This attribute exists solely for compatibility with other CFML engines. Lucee ignores this attribute as it uses its own search engine implementation. | |
| language | string | No | Specifies the language analyzer to use for the collection, which affects tokenization, stemming, and stop word handling. Supported languages include: |
|
| mode | string | No | Specifies the search algorithm to use when querying this collection. Options: When set to `keyword`, the `embedding` attribute is ignored. Vector and hybrid modes require an embedding service to be specified. |
|
| name | string | No | Variable name for storing the query results returned by the `list` or `categoryList` actions. This query contains metadata about collections or categories depending on the action used. |
|
| path | string | No | Absolute filesystem path where the Lucene collection will be stored. Required when creating a new collection or mapping to an existing one. | |
| ratio | numeric | No | When `mode="hybrid"`, this value controls the balance between keyword and vector search components. Value range is 0.0 to 1.0, where: For example, a ratio of 0.7 would give 70% weight to vector search and 30% to keyword search. This attribute is ignored when mode is not "hybrid". |