Description
Creates and administers Solr search engine collections.
Category
Syntax
cfcollection supports script style syntax: new collection().CREATE(collection="<collection_name>", engine="solr", path="<path to the solr directory>"); <cfcollection action = "action" categories = "yes|no" collection = "collection name" engine = "solr language = "language" name = "query name" path = "c">
Note: You can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag's attribute names as structure keys. |
See also
cfexecute, cfindex, cfobject, cfreport, cfsearch, cfwddx
History
ColdFusion (2016 release): The path attribute is ignored.
ColdFusion 9: Added the engine attribute (required for Solr support).ColdFusion MX 7:
- Starting with ColdFusion MX 7, you cannot use the cfcollection tag to create alias names for existing collections. Because Verity maintains all the collection information, you cannot have two names point to the same collection.
- Removed reference to external collections.
- Deprecated the map and repair options of the action attribute. They might not work, and might cause an error, in later releases.
- Added categories attribute and categorylist action.
- Added CATEGORIES, SIZE, DOCCOUNT, and LASTMODIFIED to list of variables returned by the list action.
- Marked as obsolete the MAPPED, ONLINE, and REGISTERED variables returned by the list action.
ColdFusion MX: - Changed the requirements for the action attribute: it is now required.
- Added the action attribute list value. It is the default.
- Changed the requirements for the action attribute value map: it is not necessary to specify the action attribute value map. (ColdFusion detects collections and creates maps collections as required.)
- Changed acceptable collection naming: this tag accepts collection names that include spaces.
- Changed Verity operations behavior: ColdFusion supports Verity operations on Acrobat PDF files.
- Changed thrown exceptions: this tag can throw the SEARCHENGINE exception.
Attributes
Attribute |
Req/Opt |
Default |
Description |
---|---|---|---|
action |
Required; see Usage |
list |
|
categories |
See Usage |
no |
Used only for creating a collection:
|
collection |
See Usage |
|
|
engine |
Optional |
Solr |
The search engine for the collection:
|
language |
See Usage |
English |
For a list of options, see Usage. |
name |
See Usage |
|
Name for the query results returned by the list and categorylist actions. |
path |
Optional |
|
Absolute path to a collection. To map an existing collection, specify a fully qualified path to the collection (not including the collection name); for example, "C:\MyCollections\". All collections are created in the location specified in Solr Home field on the ColdFusion administration page. Note: Starting with ColdFusion 2016, the path attribute will be ignored. All the collections will be created in the collections directory at the location specified in Solr_Home field in the ColdFusion administrator page. |
With this tag you can
- Create Solr collections.
- Administer Solr collections created by this tag or the ColdFusion Administrator.
The following table shows the dependence relationships among this tag's attribute values:
This attribute is required, optional, or unnecessary (blank): |
For this action attribute value: |
||||||
---|---|---|---|---|---|---|---|
|
list |
create |
map |
optimize |
repair |
delete |
category list |
collection |
|
Required |
Required |
Required |
Required |
Required |
Required |
path (Deprecated) |
|
|
|
|
|
|
|
language |
|
Optional |
Optional |
|
|
|
|
name |
Required |
|
|
|
|
|
Required |
categories |
|
|
|
|
|
|
|
The following examples show the structures returned by the categorylist action:
CATEGORIES |
|
---|---|
blue |
10 |
green |
3 |
magenta |
3 |
purple |
2 |
CATEGORYTREES |
|
a/ |
10 |
a/b |
10 |
a/b/c |
10 |
a/b/c/subdir |
3 |
The list action returns the following information in a result set that contains one row per collection:
Column |
Contents |
---|---|
CATEGORIES |
|
CHARSET |
The character set of the collection. |
CREATED |
The date and time that the collection was created. |
DOCCOUNT |
The number of documents in this collection. |
EXTERNAL |
|
LANGUAGE |
The locale setting of the collection. This information is not available for K2Server collections. |
LASTMODIFIED |
The date and time that the collection was last changed. |
MAPPED |
Obsolete. |
NAME |
The name of the collection. |
ONLINE |
Obsolete. |
PATH |
Absolute path to the collection. |
REGISTERED |
Obsolete. |
SIZE |
The size of the collection, expressed in kilobytes. |
You can also specify uni to enable support for multiple languages.
To determine whether a collection exists, use code, such as the following, to execute a query of queries:
<cfcollection action="list" name="myCollections" > <cfquery name="qoq" dbtype="query"> SELECT * from myCollections WHERE myCollections.name = 'myCollectionName' </cfquery> <cfif qoq.recordcount GT 0> <!--- Collection exists ---> <cfdump var = #qoq#> </cfif>
To determine whether a Solr collection exists, you must specifically add the attribute engine and provide the value as solr. For example,{{<cfcollection action="list" name="myCollections" engine="solr">}}To get a result set with values for all the collections that are registered with the search server, use code such as the following:
<cfcollection action="list" name="myCollections"> <cfoutput query="myCollections"> #name#<br> </cfoutput>
To add content to a collection, use cfindex. To search a collection, use cfsearch.Restart the ColdFusion Search Service for this change to take effect.
For Solr collections, the language attribute of this tag supports the following options:
Brazilian |
cjk (Chinese, Japanese, Korean) |
French |
Russian |
Czech |
Dutch |
German |
Thai |
Chinese |
English |
Greek |
|