you're probably better using the startrow and maxrows on the <cfoutput>
instead.




                                                                                       
                            
                    "Chris                                                             
                            
                    Tazewell"            To:     <[EMAIL PROTECTED]>                   
                  
                    <[EMAIL PROTECTED]        cc:                                      
                                 
                    ll.co.uk>            Subject:     [ cf-dev ] CFSearch: a laugh a 
minute                        
                                                                                       
                            
                    26/06/2004                                                         
                            
                    14:54                                                              
                            
                    Please                                                             
                            
                    respond to                                                         
                            
                    dev                                                                
                            
                                                                                       
                            
                                                                                       
                            



I've always thought that CFSearch was rather "quirky", to say the least.

Firstly there's the maxrows facility in CF 5, that when specified, will
actually spit out one more row than the number input. So a cfsearch with
maxrows set to 10, say, will actually return 11 records.

Genius!

I can live with this.

However, what I was surprised about with CFMX (6.1), is that MM have
managed to fix this rather blindingly obvious error. It now spits out up to
the exact number specified in Maxrows.

Woohoo!

Exactly, that is, unless you specify a different start row. In my usual
fashion, I create a search engine that outputs 10 or 20 rows at a time. The
first time the search is run, there's a test search to find out how many
results the search produces. Then the real search for output goes something
like this:

<cfsearch criteria="#Trim(attributes.Criteria)#" type="SIMPLE"
   maxrows="20" collection="#request.CollectionName#"
   startrow="#attributes.Startrow#" name="FullSearch">

so attributes.Startrow will be 1, 11, 21...

All well and good in CF5, but in MX, as soon as the second result set is
called for, nothing comes out the other end.
It took me quite a while to figure out what's going on. I checked the
macromedia knowledge base (which only takes about 4 hours to find
anything), nothing. I checked the MM forums (which takes about 3 hours per
search), nada.

So I tried the following:

<cfsearch criteria="*" type="SIMPLE"
 collection="#Request.CollectionName#" name="Search1">
<cfsearch criteria="*" type="SIMPLE" maxrows="10"
 collection="#Request.CollectionName#" startrow="1" name="Search2">
<cfsearch criteria="*" type="SIMPLE" maxrows="10"
 collection="#Request.CollectionName#" startrow="11" name="Search3">
<cfsearch criteria="*" type="SIMPLE" maxrows="20"
 collection="#Request.CollectionName#" startrow="11" name="Search4">

<cfdump var="#Search1#">
<cfdump var="#Search2#">
<cfdump var="#Search3#">
<cfdump var="#Search4#">


And here are the results:

Search 1: 109 records
Search 2: 10 records
Search 3: 0 records
Search 4: 10 records

So it turns out that Maxrows in MX isn't maxrows at all... The
functionality is really Endrow.

Pure bloody genius on a stick!

Taz




-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]

Reply via email to