<cfcollection>
Allows you to create and administer Search collections.
This tag cannot have a body.
This tag is also supported within <cfscript>
<cfcollection
engine=string
categories=boolean
action=create|repair|delete|optimize|list|map|categoryList
collection=string
path=string
language=string
name=string
mode=hybrid|keyword|vector
embedding=string
ratio=numeric
>
| Attribute | Description | Default |
|---|---|---|
engine
string, optional
|
edit
This attribute only exists for compatibility reasons to other CFML engines, the attribute is completely ignored by Lucee. |
|
categories
boolean, optional
|
edit
Boolean. Enables category support for the collection.
Used only when |
|
action
string, optional
|
edit
Specifies the action to perform.
|
list |
collection
string, optional
|
edit
Specifies a collection name or an alias if action = "map" |
|
path
string, optional
|
edit
Absolute path to a Lucene collection. |
|
language
string, optional
|
edit
language the collection is based on: possible values are: english, german, russian, dutch, french, italian, norwegian, portuguese, spanish, brazilian, chinese, greek, thai, danish, japanese, norwegian, korean |
|
name
string, optional
|
edit
Name for the query results returned by the list action. Alias: variable |
|
mode
string, optional
|
edit
Specifies the search algorithm to use when querying this collection. Options:
When set to Introduced: 7.0.0.221 |
|
embedding
string, optional
|
edit
Specifies the embedding service to use for creating vector representations of documents, enabling semantic search capabilities. Valid options:
Alias: embeddingservice Introduced: 7.0.0.218 |
|
ratio
numeric, optional
|
edit
When 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". Introduced: 7.0.0.221 |
Examples
editCreate a collection
cfcollection(
action="create",
collection="myCollection",
path=expandPath( "{lucee-config-dir}/collections/myCollection" ),
language="english"
);
Create a collection with category support
cfcollection(
action="create",
collection="myCollection",
path=expandPath( "{lucee-config-dir}/collections/myCollection" ),
language="english",
categories="yes"
);
List all collections
cfcollection( action="list", name="collections" );
dump( collections );
Optimize a collection
cfcollection( action="optimize", collection="myCollection" );
Delete a collection
cfcollection( action="delete", collection="myCollection" );
See also
- Search
- Lucene 3 Extension
- Adding Full Text Search to Your Application
- <cfindex>
- <cfsearch>
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)