Go to part two of this tutorial4

Verity Search

If your site has a lot of content, text files, or even Excel spreadsheets, you may want to consider using the Verity Search Collection in ColdFusion. Verity Collections allow you to index your site and create a ?map? if you will, of your files. Even the contents of your doc files, PDF?s, and spreadsheets. What will really amaze you is how little it takes to set up and create.

First of all you need access to the CF administrator, or you need to have the server administrator configure the server to index your site. If you run your own server then this will be a snap.

PART ONE - Configuring the server

Open the ColdFusion administration page and log in. On the Left hand side under ?Datasources? is a link labeled ?Verity Collections? Click the link.

This is the page you will no be on. In the first section create a NAME for your collection. This can be any name that you wish to use. I will call it ?boxcar? for now.

The PATH field is for the location you would like to store the collection file. It is not to be confused with the location of the files you want index. Leave it at the default setting unless you have reason to change it.

Next Click the button ?Create Collection?

The field for file extensions has a few default file types already in place, however you may want to add other file types. Here is a list of files that are common that you might use. Just add the appropriate extension to the list.
Rich Text Format
Microsoft word

DIRECTORY PATH is the physical location of the files on your server. IE C:\www\my_site

The RECURSIVE INDEX SUB DIRECTORY check box may be checked if you want the index to include files beneath the selected directory.

Last but not least, the RETURN URL. This is the actual path for your HTTP files.
IE. http://my_server/my_site/
It?s important to get the URL correct as this is used to create the links in your search results.

Now click Submit, your server will now index your site.

PART TWO ? Creating the search forms
Search this site</title>


   <strong>What would you like to search for? </strong>
   <form name="form1" method="post" action="verity_search_results.cfm">
      <input name="criteria" type="text" id="criteria">
      <input type=
"submit" name="Submit" value="Submit">

<!--- Define a search name and specify the COLLECTION name used in the CF Admin.--->
<CFSEARCH NAME="search_boxcar"

Search Results</title>

Your search results </h3>

<!--- Output search results complete with score --->
<CFOUTPUT QUERY="search_boxcar">
    <a href="#URL#">#Title#</a><br>
    Score: #Score#<p>


The key here is the CFSEARCH tag. It is the easiest search ever and no SQL involved. However, if you want to add an SQL statement you can do more with it. Like search you database or your query.

That?s all there is to it.

Go to part two of this tutorial4

About This Tutorial
Author: Mark Aplet
Skill Level: Beginner 
Platforms Tested: CF5
Total Views: 176,735
Submission Date: February 01, 2003
Last Update Date: June 05, 2009
All Tutorials By This Autor: 8
Discuss This Tutorial
  • Isnt it the form meant to go to search_results.cfm instead of variety_search_results.cfm ???

  • Does anyone know how the 'score' value is calculated?


Website Designed and Developed by Pablo Varando.