You can efficiently get the length of a search iterator with len():
len()
if len(rows): # ... do something...