You configure K2 Server to work with ColdFusion with the following steps:
k2server
executable. (See "Starting K2 Server".)
To enable a collection for searching using K2 Server, you must first configure the k2server.ini file. This file is located in the cf_root\lib\ directory in Windows, and in the cf_root/lib/ directory in UNIX.
In these pathnames, cf_root refers to the ColdFusion root directory. In Windows, this is typically C:\CFusionMX; in UNIX, this is typically /opt/coldfusionmx.
The k2server.ini file consists of several parameters that typically remain unchanged. You must verify or make minor edits to settings in the portNo, vdkHome, and Coll-n sections.
Tip: Use your text editor's search function to locate the appropriate code. For example, to locate the settings for the port number, as described in the next step of this procedure, search for portNo=.
Note: If you did not install ColdFusion into the default directory, edit the paths in this procedure to reflect the appropriate directories.
##portNo: TCP port number for client connections. portNo=9901
## vdkHome: directory containing Verity resources (common directory) - need it running as an NT service ## vdkHome=c:/cfusionmx/lib/common
Note: If you run K2 Server as a Windows NT service, you must remove the pound signs (##) in the highlighted line above to uncomment the code. If the line remains as a comment, K2 Server will not execute correctly.
collPath
parameter the directory of a collection that K2 Server will search:[Coll-0] collPath=c:\cfusionmx\verity\collections\test_01\file collAlias=test_01_file
The collPath
value must point to an existing Verity collection; the k2server executable cannot be used to create a collection.
Note: The final subdirectory for your collPath might differ, based on whether it is an external collection (that is, a native Verity tool created it) or ColdFusion created it. If ColdFusion created the collection, there are file and custom subdirectories; these subdirectories are not present in external collections. For more information, see "Collection structure and ColdFusion".
collAlias
parameter:[Coll-0] collPath=c:\cfusionmx\verity\collections\test_01\file collAlias=test_01_file
You use this value to reference the collection in CFML.
Note: Collection alias values must be unique. They must be different from any collection names managed by ColdFusion.
The following CFML code performs a K2 mode search on the test_01_file collection:
<cfsearch
collection="test_01_file"
name="getData"
criteria="#form.criteria#">
Note: To search multiple collections, use a comma-delimited list. For example, use collection="test_01_file,test_02_file"
in your cfsearch
tag. Within a single cfsearch
tag, the collections must be either all K2 Server-registered or all ColdFusion-registered; you cannot use one cfsearch
tag to search a K2 Server-registered collection and a ColdFusion-registered collection.
In the following example, the collPath
value points to a collection for the ColdFusion online documentation:
[Coll-1] collPath=c:\cfusionmx\verity\collections\cfdocumentation\custom collAlias=cfdoc_custom topicSet= knowledgeBase= onLine=2
Coll-n
section for other collections that you want to search with K2 Server. For each entry, increment the value n by one. The first collection is number 0, not number 1, as in the following example:[Coll-2] collPath=C:\cfusionmx\Verity\Collections\bbb\file collAlias=bbb_file
For more information about k2server.ini parameters, see "The k2server.ini parameter reference".
You start K2 Server from the command line in UNIX or Windows. In UNIX, you run the startk2server script; in Windows, you run the startk2server.bat file. These files are located in the cf_root\lib\ directory in Windows, and in the cf_root/lib/ directory in UNIX.
In Windows, you can start K2 Server as a service by entering the following command in the cf_root\lib\ directory:
k2server -ntservice 1
-inifile k2server.ini
Note: Macromedia does not recommend running K2 Server as a Windows service. You must stop the service before you modify or delete collections registered with K2 Server. You must then remember to restart the service. You must also verify that the vdkHome information in your k2server.ini file is uncommented-that is, it has no leading pound (#) signs-and points to the correct location of the common directory.
You use the Verity K2 Server page in the ColdFusion Administrator to specify the hostname and port number for the K2 Server you want to use, as the following figure shows:
Make sure that you started K2 Server on the host you specify in the Verity Server hostname field. Also, the port number you enter must match the port number you specify in the k2server.ini file.