CFSEARCH | |||||||||||||||||||||||
Description | |||||||||||||||||||||||
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:
|
|||||||||||||||||||||||
A collection can be registered with ColdFusion in the following ways:
|
|||||||||||||||||||||||
A collection can be registered with K2Server by editing the k2server.ini file. | |||||||||||||||||||||||
A collection can be indexed in the following ways:
|
|||||||||||||||||||||||
For more information, see Chapter 24, "Building a Search Interface," in Developing ColdFusion MX Applications. | |||||||||||||||||||||||
Category | |||||||||||||||||||||||
Extensibility tags | |||||||||||||||||||||||
Syntax<cfsearch name = "search_name" collection = "collection_name" type = "criteria" criteria = "search_expression" maxRows = "number" startRow = "row_number" language = "language"> |
|||||||||||||||||||||||
See also | |||||||||||||||||||||||
cfcollection, cfexecute, cfindex, cfobject, cfreport, cfwddx | |||||||||||||||||||||||
History | |||||||||||||||||||||||
ColdFusion MX:
|
|||||||||||||||||||||||
Usage | |||||||||||||||||||||||
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:
|
|||||||||||||||||||||||
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 Chapter 25, "Using Verity Search Expressions," in Developing ColdFusion MX Applications. | |||||||||||||||||||||||
cfsearch result columns
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# |
|||||||||||||||||||||||
Example<!--- #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> |
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 | |
Default value: "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 Chapter 25, "Using Verity Search Expressions," in Developing ColdFusion MX Applications. |
MAXROWS | |
Optional | |
Default value: "All"
Maximum number of rows to return in query results. Use double or single quotation marks. |
STARTROW | |
Optional | |
Default value: "1"
First row number to get. |
LANGUAGE | |
Optional | |
Default value: "english"
For options, see cfcollection. Requires the ColdFusion International Search Pack. |