code: def iterator(self):
          results = super(SearchableQuerySet, self).iterator()
          if self._search_terms and not self._search_ordered:
              results = list(results)
              for i, result in enumerate(results):
                  count = 0
                  related_weights = []
                  for (field, weight) in self._search_fields.items():
                      if "__" in field:
                          related_weights.append(weight)
                      for term in self._search_terms:
                          field_value = getattr(result, field, None)
                          if field_value:
                              count += field_value.lower().count(term) * weight
                  if not count and related_weights:
                      count = int(sum(related_weights) / len(related_weights))
                  results[i].result_count = count
              return iter(results)
          return results