I do search diffrently,
I first get ALL the results (as COUNT(*)) into a variable, which I transfer
from page to page.
Then I QUERY search with maxrows=20 (or as many as you want displayed on a
single page).
then every time a user click next, he's transfering some info on the urls:
1- recordcount of all results (i.e rc)
2- unique ID of the last item found (i.e lastid)
3- the search to search for, ofcourse (i.e searchstring)
then you can specify on the BIG count(*) query:
<cfif NOT isDefined("url.rc")>
<QUERY
SELECT COUNT(*) from whatever whereever
/QUERY>
<cfset url.rc=allresults.recordcount>
</cfif>
[meaning: if you don't know how much records are in total, run big query]
then specify the search ONLY for this search
<QUERY
SELECT field1,field2,field2 from whatever where field1='#searchstring#'
<cfif isDefined("url.lastid")> and fieldid > url.lastid </cfif>
/QUERY>
[meaning: search for results, if lastid exists, search FROM THIS id on]
By the way, you can also use verity's capability to specify: Startrow and
Maxrow
if the searchstring stays the same and you just want to move from page to
page,
move along a url.counter variable and specify :
<cfsearch collection="searchwithin" name="results" type="SIMPLE"
criteria="*#searchstring#*"
startrow="#evaluate((url.counter-1)*maxdisplay+1)#" maxrows="20">
the big search for just getting the result amount is:
<cfif NOT isDefined("url.rc")>
<cfsearch collection="groups001" name="results" type="SIMPLE"
criteria="*#searchstring#*">
<cfset url.rc=results.recordcount>
</cfif>
Contact me if you need a hand!
Thanks,
Michael Lugassy
IT/WEB Specialist
Interactive Music Ltd.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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