Hi,
I'm implementing my first Verity search function, and I'm having
a few problems with the output.
I'm sure it's a common thing to have to grab extra database info
for records returned from a Verity search, i.e. you've indexed and
search a bunch of PDF's, but you also keep the file info in a database,
and you want to associate this file info with each returned search
results.
The way I've done it is to create a new query, loop through the
search results, query the database for each result (matching on
filename), and building the new query row by row. (There's also
a check to make sure each returned result is flagged as active.)
Now it seems to be working fine, but every now and then it seems
that a whole row of the new query has been set to NULL or
empty strings. I've had a good look over it and I'm baffled.
My questions are:
1) Any idea what could be going on here?
2) In any case, is there a more efficient way to associate DB
info with Verity results like this? (I know indexing queries
allows you to put 'custom1' and 'custom2' in, but of course
this is no good for file indices.)
The code I'm using for creating the new query is as follows:
.........................................
<cfsearch collection="#form.searchArea#" name="searchResults" type="SIMPLE"
criteria="#form.keyword#">
<!--- If searching downloads, grab extra database info --->
<cfif form.searchArea is "downloads">
<cfset downloadsResults=QueryNew("title, score, url, filesize, filetype,
upload_date")>
<cfoutput query="searchResults">
<cfset temp=QueryAddRow(downloadsResults)>
<cfset downloadName=GetFileFromPath(searchResults.url)>
<cfquery name="getData" datasource="#request.dsn#" dbtype="ODBC">
SELECT title, filesize, filetype, upload_date, activated
FROM downloads
WHERE filename+'.'+filetype = '#downloadName#'
</cfquery>
<cfif getData.activated>
<cfset temp=QuerySetCell(downloadsResults,"title",getData.title)>
<cfset
temp=QuerySetCell(downloadsResults,"score",searchResults.score)>
<cfset temp=QuerySetCell(downloadsResults,"url",searchResults.url)>
<cfset
temp=QuerySetCell(downloadsResults,"filesize",getData.filesize)>
<cfset
temp=QuerySetCell(downloadsResults,"filetype",getData.filetype)>
<cfset
temp=QuerySetCell(downloadsResults,"upload_date",getData.upload_date)>
</cfif>
</cfoutput>
</cfif>
.........................................
Any help much appreciated!
- Gyrus
------------------------------------
[EMAIL PROTECTED]
work: http://www.tengai.co.uk/steve/
play: http://www.norlonto.net
------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists