Searches Verity collections using ColdFusion or K2Server, whichever search engine a collection is registered by. (ColdFusion can also search collections that have not been registered, with the cfcollection
tag.)
A collection must be created and indexed before this tag can return search results.
A collection can be created in these ways:
cfcollection
tag A collection can be registered with ColdFusion in the following ways:
cfcollection
tag A collection can be registered with K2Server by editing the k2server.ini file.
A collection can be indexed in the following ways:
cfindex
tag For more information, see Developing ColdFusion MX Applications with CFML.
<cfsearch name = "search_name" collection = "collection_name" type = "criteria" criteria = "search_expression" maxRows = "number" startRow = "row_number" language = "language">
cfcollection,
cfexecute,
cfindex,
cfobject,
cfreport,
cfwddx
New in ColdFusion MX: the The external
attribute is deprecated. Do not use it in new applications. It might not work, and might cause an error, in later releases. (ColdFusion stores this information about each collection; it automatically detects whether a collection is internal or external.) This tag supports absolute (also known as fully qualified) collection pathnames and mapped collection names.
New in ColdFusion MX: ColdFusion can create collections, index query results and delete index keys.
New in ColdFusion MX: ColdFusion supports Verity operations on Acrobat PDF files.
New in ColdFusion MX: This tag can search multiple collections. In a multiple collection search, you cannot combine collections that are registered with K2Server and and registered in another way.
New in ColdFusion MX: This tag accepts collection names that include spaces.
New in ColdFusion MX: this tag supports Verity 2.6.1 and the LinguistX and ICU locales.
New in ColdFusion MX: This tag can throw the SEARCHENGINE exception.
Attribute | Req/Opt | Default | Description |
---|---|---|---|
name |
Required |
|
Name of the search query. |
collection |
Required |
|
One or more path(s) and/or registered collection name(s). For a registered collection, specify the collection name. For an unregistered collection, specify an absolute path. Registered names are listed in the ColdFusion Administrator, Verity Collections and Verity Server pages. To specify multiple collections, use a comma delimiter. For example: "CFUSER , e:\collections\personnel If you specify multiple collections, you cannot include a combination of collections that are registered by K2Server and registered by Verity. |
type |
Optional |
simple |
|
criteria |
Optional |
|
Search criteria. Follows the syntax rules of the type attribute. If you pass a mixed-case entry in this attribute, the search is case-sensitive. If you pass all uppercase or all lowercase, the search is case-insensitive. Follow Verity syntax and delimiter character rules; see Developing ColdFusion MX Applications with CFML. |
maxRows |
Optional |
All |
Maximum number of rows to return in query results. Use double or single quotation marks. |
startRow |
Optional |
1 |
First row number to get. |
language |
Optional |
english |
For options, see "cfcollection". Requires the ColdFusion International Search Pack. |
To permit application users to search Verity collections for non-standard strings, words or characters (for example, "AB23.45.67" or "--->") that would otherwise cause an error, you can create a text file that lists these elements and defines their formats for Verity. Name the file style.lex and put copies of the file in these directories:
Note: To search for a character such as an angle bracket (< or >), you must use a criteria
attribute value such as "<:"
or "<:"
. The bracket characters are reserved in Verity, and using a backslash to escape the character (criteria="\<"
) does not work in this context. For more information, see Developing ColdFusion MX Applications with CFML.
Macromedia does not recommend using the cflock
tag with this tag; Verity provides the locking function. Using the cflock
tag slows search performance.
This tag returns a record set whose columns you can reference in a cfoutput
tag. For example, the following code specifies a search for the exact terms "filming" or "filmed":
<cfsearch name = "mySearch" collection = "myCollection" criteria = '<WILDCARD>`film{ing,ed}`' type="explicit" startrow=1>
<cfdump var = "#mySearch#>
In this example, the single quotation mark ('
) and backtick (`
) characters are used as delimiters; for more information, see Developing ColdFusion MX Applications with CFML.
You can use query result columns in standard CFML expressions, preceding the result column name with the name of the query, as follows:
#DocSearch.url#
#DocSearch.key# #DocSearch.title# #DocSearch.score#
<!--- #1 (TYPE=SIMPLE) -----------------------------> <cfsearch name="name" collection="snippets,syntax,snippets" criteria="example" > <p> <cfoutput>Search Result total = #name.RecordCount# </cfoutput><br> <cfoutput> url=#name.url#<br> key=#name.key#<br> title=#name.title#<br> score=#name.score#<br> custom1=#name.custom1#<br> custom2=#name.custom2#<br> summary=#name.summary#<br> recordcount=#name.recordcount#<br> currentrow=#name.currentrow#<br> columnlist=#name.columnlist#<br> recordssearched=#name.recordssearched#<br> </cfoutput> <cfdump var = #name#> <br> <!--- #2 (TYPE=EXPLICIT) -----------------------------> <cfsearch name = "snippets" collection = "snippets" criteria = '<wildcard>`film{ing,ed}`' type="explicit" startrow=1> <cfoutput query="snippets"> url=#url#<br> key=#key#<br> title=#title#<br> score=#score#<br> custom1=#custom1#<br> custom2=#custom2#<br> summary=#summary#<br> recordcount=#recordcount#<br> currentrow=#currentrow#<br> columnlist=#columnlist#<br> recordssearched=#recordssearched#<br> </cfoutput> <cfdump var = #snippets#> <br> <!--- #3 (search by CF key) -----------------------------> <cfsearch name = "book" collection = "custom_book" criteria = "cf_key=bookid2"> <cfoutput> url=#book.url#<br> key=#book.key#<br> title=#book.titleE#<br> score=#book.score#<br> custom1=#book.custom1#<br> custom2=#book.custom2#<br> summary=#book.summary#<br> recordcount=#book.recordcount#<br> currentrow=#book.currentrow#<br> columnlist=#book.columnlist#<br> recordssearched=#book.recordssearched#<br> </cfoutput> <cfdump var = #book#> <br>