Yep its relatively easy. Create your collection, then do a query against the
database. 

<cfquery name="VIndex" 
         etc., >
         
               <!--- do your SQL stuff here. --->
    
</cfquery>

Then refresh the collection using 

<cfindex action="REFRESH"
         collection="AccInfoSearch"
         key="keyvalue"
           title="titlevalue"
         type="CUSTOM"
         query="vIndex"
         body="put all the db fields in here that you want included in the
index.">

Then to do the Verity search, you'd do something like this - note
attributes.ADVSearch contains the search parameters>
        <cfsearch collection="CollectionName"
                  name="OutputQuery Name"
                criteria="#lcase(attributes.ADVSearch)#">

Then you take the returned key value name and do a cfquery to get the
information from the database:
<cfif AdvSearch.recordcount ge 1><!--- make sure there's only one result

<CFLOCK TIMEOUT="30" THROWONTIMEOUT="Yes" TYPE="EXCLUSIVE"
name="searchLock">
        <cfparam name="session.searchtable" default="">
        <cfquery name="SearchTable" 
        etc >
                SQL goes in here
                                 and PrimaryKey  in
(#quotedvaluelist(AdvSearch.key)#)
                </cfquery>
<!---   add the verity relevance score to the database query object --->

<cfset addcol =
queryAddColumn(searchTable,"Score",listToArray(valueList(AdvSearch.score)))>
<!--- save the query into a session variable
<cfset session.searchTable = Duplicate(searchtable)>
        </CFLOCK>
        <CFLOCK TIMEOUT="30" TYPE="READONLY" name="searchlock">
<!--- put the results into a request variable for display. --->
                <cfset request.searchtable = Duplicate(session.SearchTable)>
        </CFLOCK>


You can also mix this with a Verity collection of files and directories.

hth,

larry
--
Larry C. Lyons
ColdFusion/Web Developer
Certified Advanced ColdFusion 5 Developer
EBStor.com
8870 Rixlew Lane, Suite 204
Manassas, Virginia 20109-3795
tel:   (703) 393-7930
fax:   (703) 393-2659
Web:   http://www.ebstor.com
       http://www.pacel.com
email: [EMAIL PROTECTED]
Chaos, panic, and disorder - my work here is done.
--

> -----Original Message-----
> From: Scott Raley [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 01, 2002 12:51 PM
> To: CF-Community
> Subject: Verity
> 
> 
> Does anyone know ifyou can use the verity that comes with CF5 
> to search through
> a database?
> 
> 
> 
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to