I have a search results page that displays a max of 100 records at a shot.
Sometimes the total results exceed several thousand records.  In an attempt
to speed up the 'next page' processing I no longer use the CFSEARCH using
startrow with the CFOUTPUT query using maxrows b/c of the processing time to
research all the indexes I have created.  I now do the CFSEARCH and use the
CFOUTPUT query using maxrow and startrow (which is calculated and passed)
the first time into the form.  I use WDDX to convert the results of the
search and pass it.  I am calling the same form over again and determine if
this is the first call or a call there after.  If it is not the first time,
I convert the query from WDDX and run CFOUTPUT query.

THE PROBLEM:  Sometimes, if there are a high number of result records, there
is a long processing time on the results page after the first time.  Is this
common with passing the results using WDDX or is there a better way to do
this type of next page processing for search results?  Also, when I process
'next page' more than once the BACK button on the browser is disabled and I
can not get back to the original 100 results.

....a bit of code.....FORM is SearchResult_test.cfm

<CFIF form.FirstTime IS "True">
        <CFSET Form.StartRow = 1>
        
        <CFSEARCH 
                name = "GetResults"
                collection = "#SearchCollection#"
                criteria = "#Form.Criteria#"
                startRow = "#Form.StartRow#"
        >
<CFELSE>
        <CFWDDX ACTION="WDDX2CFML" INPUT="#URLDecode(FORM.queryResults)#"
OUTPUT="GetResults">
</CFIF>

........some processing.........

        <TABLE cellspacing=0 cellpadding=2>
            <!--- table header ---> 
                <TR bgcolor="cccccc">
                <TD></TD>
                <TD><B>No</B></TD>
                <TD><B>Score</B></TD>
                <TD><B>File</B></TD>
                <TD><B>Title</B></TD>
                <TD><B>Search Category</B></TD>
                </TR>
                <CFSET row = #Form.StartRow#>
                <CFOUTPUT query="GetResults" maxRows="#Form.MaxRows#"
startrow="#Form.StartRow#">
                        
................................lotsa processing to display the
results...........................................

                </CFOUTPUT>             <!--- End of the query to list
files. --->
        </TABLE>

        <!---  pass the query to another form. --->     
        <CFWDDX ACTION="CFML2WDDX" INPUT="#GetResults#" OUTPUT="MyQuery">
        

        <FORM action="SearchResult_test.cfm" method="post">
                <CFOUTPUT>
                        .............Hidden input
fields........................
                        
                        <INPUT type="hidden" name="queryResults"
value="#URLEncodedFormat(MyQuery)#">
                        
                        <CFIF #Evaluate(Form.StartRow + Form.MaxRows -1 )#
lt GetResults.RecordCount>
                                <INPUT type="submit" name="Operation"
value="    More ...   ">
                        </CFIF>
                        <CFIF IsDefined("Form.StartRow") IS False OR
#Form.StartRow# eq 1>
        <CFSET Form.FirstTime = "False">
        
        

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to