Would anybody know of a way to sort the results of a cfsearch by another field (other than by relevance). I have tried putting the results into an array, then performing a bubble sort on the array, but this is time consuming for result sets greater than 100 items. I am specifically trying to order the results by descending date order. Any ideas?
Try making a comma delimited list of the ID's of the found records ( eg found_list
= "9,12,98,123,492,494,233") by looping over the results. Then query from database
for ID's in this list and do the sorting there:
WHERE ID IN (#found_list#)
ORDER BY #my_sort_field#
This should work until your SQL statement is at least 16k in size - or approx 2000
hits. After that you will need to put found ID's in a temporary subtable and join
back to the main one for sorting.