3Back to part one of this tutorial

For part two of this tutorial we will be keeping the search form that was created earlier in part one. We will also need to add an update page to update our collection with the db info. Lastly we will be modifying the results page just a bit.

Just to recap here is the search form once more:
Search this site</title>

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">

Now, we want to the ability to update our collection as our site grows so, what we need to do is create an update collection page. Ill call this verity_update.cfm

Here Is what I did:

Update Verity Collection</title>
    <meta http-equiv=
"Content-Type" content="text/html; charset=iso-8859-1">


  <cfquery name="get_db_info" datasource="#dsn#">
      select *
       from YourTable

<cfindex query="get_db_info" <!--- Specify the query from above. --->
"YourCollection" <!--- Specify What Collection to Update. --->
"update" <!--- Actions include: update, delete, refresh, or purge. --->
"custom" <!--- If action is update or delete "custom" type is required. --->
"SomeFieldname" <!--- Key is usually set to your Key Fieldname. It will be referenced later. --->
"AnotherFieldname" <!--- The Title will appear in the list of verity results. --->
"CustomFieldname" <!--- You may add a custom1 and custom2 field if additional information is needed. --->
"Fields, To, Be, Indexed"> <!--- Body to be indexed, sepertaed by comas. --->

  Your Collection has been updated.

Lastly we need to make the modifications to the results page.

Verity Search Results</title>
    <meta http-equiv=
"Content-Type" content="text/html; charset=iso-8859-1">


  <!--- Use CFSEARCH Tag with collection information here --->
  <cfsearch name="YourSearchName"

  <!--- Begin displaying results of your serch --->
  <strong>Your Results</strong> 

<!--- Here I'll demonstrate How to use verity to display different types of data --->
<!--- By checking the results to see if the page is indexed or if the data is from the db I can switch modes here. --->

<cfoutput query="YourSearchName"> 
   <cfif URL IS "">
     <p><a href="item_details.cfm?Item_ID=#key#">#title#</a><br>
     Score: #score#</p>
     <p><a href="#URL#">#title#</a><br>
     Score: #score#</p>


That's pretty much it. Very simple but effective.

3Back to part one of this tutorial

About This Tutorial
Author: Mark Aplet
Skill Level: Beginner 
Platforms Tested: CF5
Total Views: 116,661
Submission Date: May 05, 2003
Last Update Date: June 05, 2009
All Tutorials By This Autor: 8
Discuss This Tutorial
  • Pages that have cfincludes does not show. Like for example, if I have a cfinclude which list my favorite colors, searching one color would not give me the page.

  • So does the update page rerun the query on the coldfusion server to re-index the page? I don't understand what database we are trying to connect to here. More info please.

  • Would you please provide more detail how to create the update page? I don't understand why you mean "" Also, it'll be very helpful if you can have a tutorial about searching access data by using the verity search engine. Thank you for your help in advance.


Sponsored By...
Mobile App Development (IOS, Android, Cordova, Phonegap, Objective-C, Java) - Austin, Texas Mobile Apps - Touch512, LLC.