<CFSEARCH NAME="search_name
" COLLECTION="collection_name" TYPE="criteria" CRITERIA="search_expression" MAXROWS="number
" STARTROW="row_number" CUSTOM1="custom_value" CUSTOM2="custom_value" EXTERNAL="Yes/No">
Use the CFSEARCH tag to execute searches against data indexed in Verity collections. Collections can either be created in Cold Fusion using the Cold Fusion Administrator or created outside Cold Fusion using native
Verity indexing tools. Collections are populated with data either with the CFINDEX tag, or externally, using native Verity indexing tools. Collections must be created and populated before any searches can be executed.
Attributes
NAME |
Required. A name for the search query. |
COLLECTION |
Required. Specifies the logical collection name that is the target of the search operation or an external collection with fully qualified path. Collection names are defined in the Cold Fusion
Administrator, Verity page.
Multiple Cold Fusion collections can be specified in a comma-separated list:
COLLECTION="CFUSER, CFLANG"
If you are searching an external collection (EXTERNAL="Yes") specify the collection name, including fully qualified path:
COLLECTION="e:\collections\personnel"
If multiple collections are specified in COLLECTION and EXTERNAL is Yes, the specified collections must all be externally generated. You cannot combine internal and external collections in the same
search operation. |
TYPE |
Optional. Specifies the criteria type for the search. Valid entries are:
- SIMPLE — By default the STEM and MANY operators are used.
- EXPLICIT — All operators must be invoked explicitly.
|
CRITERIA |
Optional. Specifies the criteria for the search following the syntactic rules specified by TYPE. |
MAXROWS |
Optional. Specifies the maximum number of entries for index queries. If omitted, all rows are returned. |
STARTROW |
Optional. Specifies the first row number to be retrieved. Default is 1. |
CUSTOM1 |
Optional. A custom field used to store data during an indexing operation. You can reference this custom field in a search operation. Specify the query column name for this custom field. |
CUSTOM2 |
Optional. A second custom field used to store data during an indexing operation. Usage is the same as for CUSTOM1. |
EXTERNAL |
Optional. Yes or No. Yes indicates that the collection you are searching was created outside of Cold Fusion using native Verity indexing tools. The default is No. |
Usage
In the CRITERIA attribute, if you pass a mixed case entry (mixed upper and lower case), case sensitivity is applied to the search. If you pass all upper or all lower case, case insensitivity is assumed.
Every search conducted with the CFSEARCH tag returns, as part of the result set, four result columns you can reference in your CFOUTPUT:
- URL — Returns the value of the URLPATH attribute defined in the CFINDEX tag used to populate the collection. This value is always empty when you populate the collection with CFINDEX when TYPE="Custom".
- KEY — Returns the value of the KEY attribute defined in the CFINDEX tag used to populate the collection.
- TITLE — Returns whatever was placed in the TITLE attribute in the CFINDEX operation used to populate the collection.
- SCORE — Returns the relevancy score of the document based on the search criteria.
- CUSTOM1 and CUSTOM2 — Returns whatever was placed in the custom fields in the CFINDEX operation used to populate the collection.
You can use these result columns in standard CFML expressions, preceding the result column name with the name of the query:
#DocSearch.URL# #DocSearch.KEY# #DocSearch.TITLE# #DocSearch.SCORE#
Example
<CFSEARCH NAME="Search1" COLLECTION="#form.source#" TYPE="#form.type#" CRITERIA="#form.searchstring#"> <H2>Search Results</H2> <CFOUTPUT> #Search1.RecordCount# #form.type# found out of #Search1.RecordsSearched# #form.type# searched. </CFOUTPUT>
|