[libRETS-users] Weird issue with SearchResult.GetCount()

Agustin Garzon agustingarzon at yahoo.com
Thu Dec 27 05:53:45 CST 2007


In my experience, the GetCount() method always returns the total # of records, not the # of records in the resultset.

Another related weird stuff I experienced was getting different GetCount() results when using the same query but changing the block size.


Hope this helps :)


Agustin



----- Original Message ----
From: David Ward <davidw at activewebsite.com>
To: librets-users at crt.realtors.org
Sent: Thursday, December 27, 2007 4:32:35 AM
Subject: [libRETS-users] Weird issue with SearchResult.GetCount()


To combat slow processing times vs timeouts, I tried the following (psuedo code)
 
<code>
ses = RetsSession
iteration = 0
blockSize = 1000
req = SearchRequest ( valid query stuff, limit = blockSize, offset =  blockSize * iteration )
result =  ses.Search( req  )
 
 
while result.GetCount() > 0:
          
          while result.HasNext():
                process row
 
           
          req = SearchRequest ( valid query stuff, limit = blockSize, offset =  blockSize * iteration )
          result =  ses.Search( req  )
 
</code>
 
I was expecting the result.GetCount() to show the size of the result, but if the entire record set is less then the blocksize ( say 972 over 1000 block size)... the really weird part begins.   After the second request, result.GetCount() returns 972 again and the result.HasNext() bit fails but the whole things begins to loop infinitely as each search request is returned.   I don't know if this is librets or the server I am dealing with, but it was a little odd.
I wrote a fix for this in my implemenation, but it was a little weird to deal with initially.
 
-David


      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.crt.realtors.org/pipermail/librets-users/attachments/20071227/c2b2aafc/attachment.html 


More information about the libRETS-users mailing list