code: def search_update_index(self):
          doc_id = self.search_get_document_id(self.key)
          fields = [search.AtomField('class_name', name) for name in self.search_get_class_names()]
          index = self.search_get_index()
          if self.searchable_fields is None:
              searchable_fields = []
              for field, prop in self._properties.items():
                  if field == 'class':
                      continue
                  for class_, field_type in SEARCHABLE_PROPERTY_TYPES.items():
                      if isinstance(prop, class_):
                          searchable_fields.append(field)
          else:
              searchable_fields = self.searchable_fields
          for f in set(searchable_fields):
              prop = self._properties[f]
              value = getattr(self, f)
              field = None
              field_found = False
              for class_, field_type in SEARCHABLE_PROPERTY_TYPES.items():
                  if isinstance(prop, class_):
                      field_found = True
                      if value is not None:
                          if isinstance(value, list) or isinstance(value, tuple) or isinstance(value, set):
                              for v in value:
                                  field = field_type(name=f, value=v)
                          elif isinstance(value, ndb.Key):
                              field = field_type(name=f, value=value.urlsafe())
                          else:
                              field = field_type(name=f, value=value)
              if not field_found:
                  raise ValueError('Cannot find field type for %r on %r' % (prop, self.__class__))
              if field is not None:
                  fields.append(field)
          document = search.Document(doc_id, fields=fields)
          index.put(document)