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:
  • `create`: Creates a new search collection
  • `repair`: Repairs a corrupted collection
  • `delete`: Removes a collection
  • `optimize`: Optimizes the collection for improved search performance
  • `list`: Returns information about all collections
  • `map`: Maps an existing collection to an alias
  • `categoryList`: Returns category information for 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:
  • `TF-IDF`: Uses Term Frequency-Inverse Document Frequency statistical method for generating document vectors
  • `word2vec`: Uses pre-trained word vectors to create document embeddings with better semantic understanding
  • *class-name*: Name of a custom class implementing the `org.lucee.extension.search.lucene.embedding.EmbeddingService` interface 
  • 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:
  • english
  • german
  • russian
  • dutch
  • french
  • italian
  • norwegian
  • portuguese
  • spanish
  • brazilian
  • chinese
  • greek
  • thai
  • danish
  • japanese
  • norwegian
  • korean 
  • mode string No Specifies the search algorithm to use when querying this collection. Options:
  • `keyword`: Traditional term-based search using Lucene (default)
  • `vector`: Pure semantic search using vector embeddings
  • `hybrid`: Combines keyword and vector search for optimal results, balancing term matching with semantic understanding
    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:
  • 0.5: Equal weight given to both keyword and vector search (default)
  • Values greater than 0.5: Greater emphasis on vector search (semantic matching)
  • Values less than 0.5: Greater emphasis on keyword search (exact term matching)
    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".