In the ColdFusion Administrator, go to Server Settings > Settings.
Indexing stores indexable data of the persistent entity in index files. Search is performed on the indexed data. The configuration you specify in the component decides the indexable data.
Specify the ORM search index directory
You can specify the index directory (the one in which all persistent entities, of an application's indexable data, are saved) either at the server-level or application-level.
At server level
-
-
In the Settings page, specify the directory details in Specify the absolute path to store index files for ORM search.
Note:A directory is created for each application with the application name, in the path you specify.
At application level
Specify the index directory path as absolute or path relative to the current Application.cfc. If you specify the relative path, then it is resolved with respect to the current folder.
If you do not specify a path, the index files are stored, by default, in cfroot/ormindex.
Search settings at application level
Specify the ColdFusion ORM search settings in the Application.cfc using the properties provided in the following table:
Property |
Req./Opt. |
Default |
Description |
---|---|---|---|
searchenabled |
Required if using ORM search |
false |
If yes, ORM search is enabled. |
search.autoIndex |
Optional |
false |
If yes, autoindexing is enabled. |
search.indexDir |
Optional |
|
If specified, creates a folder by entity name in the file system where indexes for all entities are saved. The directory you set in the ColdFusion Administrator is used for this purpose.This folder has all index information stored.If not specified, creates the folder in the application root directory. |
search.language |
Optional |
english |
Specify the language that is used to index and search. |
Example
component { this.name = "ORM_Search"; this.ormEnabled = "true"; this.ormSettings.datasource = "ORM_Dummy"; this.ormSettings.dbcreate = "dropcreate"; this.ormsettings.searchenabled = "true"; this.ormSettings.search.autoindex = "true"; this.ormSettings.search.indexDir = "C:/ormindex"; this.ormSettings.search.language = "English"; }
Search settings at the component level
Specify the following in the tag cfcomponent. The settings override the values in the Application.cfc.
Attribute |
Req/Opt |
Default |
Description |
---|---|---|---|
indexable |
Optional |
false |
If true, enables indexing for the component. |
indexLanguage |
Optional |
english |
Specify the language that is used to index and search.The value you set overrides the value defined in the Application.cfc. |
autoIndex |
Optional |
true |
If false, auto-indexing of CFC does not occur. That is, indexing occurs only in offline mode. |
Search settings at the property level
Specify the following in the tag cfproperty. The settings override the values in the Application.cfc and cfcomponent.
Attribute |
Req/Opt |
Default |
Description |
---|---|---|---|
indexable |
Optional |
false |
If true, marks the column for indexing.Except in the case of PK and compositekey (which are indexed if any of the non-PK property is set to indexed ), the default value is false. |
indexTokenized |
Optional |
true |
If true, the field text is broken into sub-keys for indexing.Applies only if indexed is set to true. |
indexFieldName |
Optional |
value of the attribute name |
Specifies the field name that is used in search query while indexing and performing search . |
indexBoost |
Optional |
|
Used to prioritize the search results. This is a numeric value.Results from this column appears above others in the query result. Higher the boost, the more the priority. |
indexStore |
Optional |
false |
The values are true, false, and compressed.
|
indexLanguage |
Optional |
english |
Specify the language that is used to index and search.The value overrides the value defined in cfcomponent and the Application.cfc. |
Example
Empoyee.cfc
component persistent="true" indexable="true" indexlanguage="English" table="Employee" { property name="id" fieldtype="id" ormtype="int" generator="native"; property name="firstname" indexable="true" indexstore="yes" indexboost="5.0"; property name="lastname" indexable="true" indextokenize="true" indexfieldname="surname"; property name="description" indexlanguage="Greek"; property name="dept" fieldtype="many-to-one" cfc="dept" indexable="true" indexfieldname="department" notnull="false"; }