I see a lot here - so forgive me if I jump around a bit.

First off - don't use parameterExists. it was deprecated a _long_ time
ago. It isn't the cause of any of your problems, but you should be
using isDefined instead.

Second - you get the valueList of keys from your Verity query. You
then store this in the application scope. Why? You could have an issue
right there if 2 people run your code at the same time. Because they
share the value, one person won't get the results they expect. I'd
just store the list of keys as a simple variable.

Third - I see you are joining a Verity result with a db result. There
is nothing wrong with that, but I notice that you only get one column
from the db. If you are only getting one column, why not just store
that value in the Verity collection? You can use one of four custom
columns.

Lastly - I have'nt used that custom tag before, but it seems like you
told it to return a sortedquery named results. But you don't even use
that query when you output.

On 8/5/07, Dylan Carlson <[EMAIL PROTECTED]> wrote:
> Does any know how to sort by key from the results of a <cfsearch>? I'm
> using Verity.
>
> I found a way by creating a list from the returned keys, then
> assigning them to an array, then query the original data and matching
> it to the returned keys, then using a custom tag by Nate Weiss to sort
> the new query. It sounds as if it would work perfectly; however, I've
> run into a few issues. Here's what I have got thus far:
>
> --- start code ---
>
> <CFIF ParameterExists(FORM.topic)>
>     <CFSEARCH COLLECTION="myCollection"
>                          NAME="getTopics"
>                          CRITERIA="#LCase(FORM.topic)#">
>    <CFSET KeyList = ValueList(getTopics.key)>
>    <CFSET application.keyArray = ListToArray(KeyList)>
> </CFIF>
>
>     <!--- if no results are returned, do not do the additional query --->
>     <!--- no files found for specified criteria? --->
>     <CFIF getTopics.RecordCount is 0>
>         <CENTER>No files found for
>         <CFOUTPUT>"#FORM.topic#"</CFOUTPUT>
>         </CENTER>
>     <CFELSE>
>
>         <!--- run a query to pull the information about the records
> that were returned as "matches" on the verity search --->
>         <CFQUERY NAME="unsortedResults" DATASOURCE="#APPLICATION.dataSource#">
>              SELECT speaker_id
>              FROM topic
>              WHERE speaker_id IN (#application.keyArray#)
>         </CFQUERY>
>
>         <!--- add score variable to query --->
>         <CFSET temp = QueryAddColumn(unsortedResults, "Key",
> application.keyArray)>
>
>         <!--- sort the query based on score --->
>         <CFIF Find("0",KeyList)>
>             <CF_QUERYSORT QUERY="unsortedResults"
>                                          SORTCOLUMN="Key"
>                                          SORTORDER="Desc"
>                                          SORTTYPE="Numeric"
>                                          SORTEDQUERY="results">
>         </CFIF>
> </CFIF>
>
> <ul>
>         <cfoutput query="getTopics">
>               <li><a
> href="test_search_details.cfm?speakerID=#key#">#getTopics.title#</a></li>
>        </cfoutput>
> </ul>
>
> --- end code ---
>
> Any help or direction would be much appreciated.
>
> Thanks.
>
> Dylan
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion is delivering applications solutions at at top companies 
around the world in government.  Find out how and where now
http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:285422
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to