How can I sort the results from cfsearch by date modified and/or by file name or title? I get the date modified field to display along with the file by using cfdirectory tag inside the loop.
I have the following code to index and search and display results:
<cfindex
action="refresh" collection="#collectionName#"
key="#uploadPath#"
type="path"
urlpath="#URLpath#"
extensions=".pdf,.doc,.txt"
recurse="yes">
<cfsearch name="GetResults"
collection="#collectionName#"
criteria="<WILDCARD>*#LCase(FORM.keywords)#*"
ContextHighlightBegin="<b>"
ContextHighlightEnd="</b>"
ContextPassages="1"
ContextBytes="500">
Display Results:
<cfset SESSION.searchResults = GetResults>
<cfoutput query="SESSION.searchResults" maxrows="#URL.maxRows#" startrow="#URL.startRow#">
<cfset FileName=GetFileFromPath(Key)>
<cfdirectory action="list" directory="#uploadPath#" name="getdatemodified" filter="#FileName#">
<a href="#url#" target="_blank">#filename#</a><cfdump var="#getdatemodified.dateLastModified#">-
<small>#Context# </small>
</cfoutput>
I have the following code to index and search and display results:
<cfindex
action="refresh" collection="#collectionName#"
key="#uploadPath#"
type="path"
urlpath="#URLpath#"
extensions=".pdf,.doc,.txt"
recurse="yes">
<cfsearch name="GetResults"
collection="#collectionName#"
criteria="<WILDCARD>*#LCase(FORM.keywords)#*"
ContextHighlightBegin="<b>"
ContextHighlightEnd="</b>"
ContextPassages="1"
ContextBytes="500">
Display Results:
<cfset SESSION.searchResults = GetResults>
<cfoutput query="SESSION.searchResults" maxrows="#URL.maxRows#" startrow="#URL.startRow#">
<cfset FileName=GetFileFromPath(Key)>
<cfdirectory action="list" directory="#uploadPath#" name="getdatemodified" filter="#FileName#">
<a href="#url#" target="_blank">#filename#</a><cfdump var="#getdatemodified.dateLastModified#">-
<small>#Context# </small>
</cfoutput>