I'm struggling with the sorting of my Verity search results . . . which I
have massaged a little in order to pull other info from a database.
I am able to successfully:
perform the search,
set up an array which matches the SCORE from the search with the NUMBER
field from my db,
run a query pulling all fields from the db for records matching search
results,
display results of query - including the score array,
sort the query results based on user input from the form.
What I'm not able to do right now is sort the query based on the score
array. Any suggestions? Please respond to the group and to my email at
[EMAIL PROTECTED] Thank you for any advice you may have . . . BJS
<!--- perform search based on criteria passed from form --->
<CFSEARCH
Collection="cwt"
name="search1"
criteria = "#criteria#"
type = "explicit"
>
<!--- Set array to match the score from the search results with the number
field from the db (custom2) --->
<cfset scr=arraynew(1)>
<cfloop query="search1">
<cfset scr[custom2]="#score#">
</cfloop>
<!--- no files found for specified criteria? --->
<CFIF search1.RecordCount is 0>
<B>No files found for specified criteria</B>
<!--- ... else at least one file found --->
<CFELSE>
<cfoutput>
<P>
Records found: #search1.recordcount#
Records Searched: #search1.recordssearched#
</cfoutput>
<!--- table header --->
<table cellspacing=2 cellpadding=2>
<tr bgcolor="cccccc">
<td align="Left" valign="bottom"><b>Score</b></td>
<td align="left" valign="bottom"><b>Filename</b></td>
<td align="left" valign="bottom"><b>Description</b></td>
<td align="left" valign="bottom"><b>Author</b></td>
<td align="left" valign="bottom"><b>Date Uploaded</b></td>
<td align="left" valign="bottom"><b>Dept</b></td>
</tr>
<!--- run query to pull in all fields from db relating to records that
matched search results --->
<CFQuery name="results" datasource="files">
SELECT *
FROM Files
WHERE number IN (#ValueList(Search1.custom2)#)
</cfquery>
<CFOUTPUT Query="RESULTS">
<!--- use Nate's QuerySort to sort query based on user input from form --->
<CF_QuerySort
QUERY="results"
SORTCOLUMN="#form.SORTBY#"
SORTORDER="asc"
SORTTYPE="textnocase"
SORTEDQUERY="results">
<tr bgcolor="#IIf(CurrentRow Mod 2, DE('ffffff'), DE('ffffcf'))#">
<td align="center" valign="top">#scr[number]# </td>
<td valign="top" width="10"><a
HREF=files/#department#/#GetFileFromPath(file_name)#>#GetFileFromPath(file_n
ame)# </A></td>
<td valign="top">#Summary# </td>
<td valign="top">#name#</td>
<td valign="top">#dateformat(date,"mm/dd/yy")#</td>
<td valign="top">#department#</td>
</tr></cfoutput></table>
</cfif>
Barbara J Smith Consulting
http://www.bjsconsulting.com
[EMAIL PROTECTED]
651.365.0822
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.