Server Time:
Thursday May 22 2008 04:05 PM  
Your Time:
  
HostMySite.Com is sponsoring this tutorial, please visit their site today!
This tutorial is sponsored by HostMySite.Com - ColdFusion Hosting

Adding an indexed Search to your site (Part 1)
by: Mark Aplet
Email this tutorial to a friend Display Printer Friendly Format
[Download in PDF Format] [Download in FlashPaper Format]

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.

VERITY COLLECTIONS
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”

INDEX VERITY COLLECTIONS
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.
ASCII Text
HTML
Lotus
Rich Text Format
Microsoft word
PDF
PowerPoint
Excel

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_form.cfm
-------------------------------------
<html>
<head>
<title>
Search this site</title>
</head>

<body>

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




-------------------------------
search_results.cfm
-------------------------------
<!--- Define a search name and specify the COLLECTION name used in the CF Admin.--->
<CFSEARCH NAME="search_boxcar"
                 COLLECTION=
"boxcar"
                 CRITERIA=
"#FORM.criteria#">

<html>
  <head>
     <title>
Search Results</title>
  </head>

<body>
<h3>
Your search results </h3>

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

</body>
</html>


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


Date added: Sat. February 1, 2003
Posted by: Mark Aplet | Views: 28094 | Tested Platforms: CF5 | Difficulty: Beginner
Categories Listed: Best Practices Verity Searching

HostMySite.Com is sponsoring this tutorial, please visit their site today!
This tutorial is sponsored by HostMySite.Com - ColdFusion Hosting

This author's other tutorials:
Banning the spam
Internet spam is on the rise, and more importantly spammers are targeting your sites comment forms. They are looking for the trackback urls to fool search engines into ranking their website higher in the search results. When this started to happen to me, I wanted to sent out emails to the offenders demanding that they stop. Unfortunatly the spam is being generated by bots and programs not some pimple faced kid behind a keyboard. Banning IP addresses is not enough and rarely works since intelligent spammers hide their true identity anyway. Next approach... Banning Keywords used by the offending sites. Thats where this tutorial comes in. - Date added: Wed. March 15, 2006
Improving Application Performance
One thing I am always trying to do is speed up my applications. As my site grows in size and complexity I find that I spend a fair amount of time re-coding pages because of a new technique I just learned. I wish I had learned about these techniques long before, and thereby allowing me to create more effective code. In this tutorial I'll try to explain some problem areas that I have identified, and some of the things you can do to improve performance. - Date added: Mon. January 12, 2004
Improving Application Performance (Part 2)
Not all queries can be saved as an application variable. For Queries that do not meet the checkpoints in my previous tutorial there is another way to improve performance. Query Caching is another way to save data and eliminate unnecessary queries. This is for queries that are more dynamic in nature. - Date added: Mon. January 12, 2004
Slighty better search
Someone on the forum posed a question a short while ago asking how to create a more advanced search function using a + symbol as a separator. So I created this advanced search function. This search function is just slightly better than a normal search as it adds the ability to separate two keywords with a + symbol. Lets start with the search form. - Date added: Thu. December 4, 2003
Dynamic Sorting with CFSWITCH
Quickly and easily sort and order records in your database using a cfswitch in your query. Great technique for admin areas of your site, or just allowing visitors to sort the fields they want. - Date added: Sun. August 3, 2003

Additional Tutorials:
· Color Picker

· Adding an indexed Search to your site (Part 2)

· Changing site color scheme
Please rate this tutorial:
5 Stars 4 Stars 3 Stars 2 Stars 1 Stars
Comments on this tutorial
Read previous comments on this particular tutorial
How is it scored?
Does anyone know how the 'score' value is calculated?
Posted by: Peter Bagnato
Posted on: 10/13/2004 06:30 PM
Error there
Isnt it the form meant to go to search_results.cfm instead of variety_search_results.cfm ???
Posted by: Louis
Posted on: 02/16/2007 12:10 AM
How do you index a database?
This is a great tutorial. However, it does not cover indexing a database. Searching a site without searching the data driving it, is not so helpful. Would you be able to add that?
Posted by: Sherry
Posted on: 05/13/2008 04:25 PM
Post a new comment on this tutorial
post a new comment on this particular tutorial
Your Name:
Your Email:
Comment Title:
Comments:
Key Phrase:
 
Skyscrapper Banner Advertisement
CF 8 Hosting for less then $40 a year!

You are 1 of 300 active sessions! | Privacy | Company
Copyright © 2002 EasyCFM.Com, LLC. (Easy ColdFusion Tutorials) All Rights Reserved (Server: www0001)
All other trademarks and copyrights are the property of their respective holders.
ColdFusion Hosting ColdFusion Hosting
ADD TO:
Blink
Del.icio.us
Digg
Furl
Google
Simpy
Spurl
Y! MyWeb