docs: def register_model(self, *index_fields, **kw):
          """Registers a single model for fulltext search. This basically creates
          a simple Whoosheer for the model and calls :func:`register_whoosheer`
          on it.
          """
          # construct subclass of AbstractWhoosheer for a model
          class ModelWhoosheer(AbstractWhoosheerMeta):
              @classmethod
              def _assign_primary(cls, primary, primary_is_numeric, attrs, model):
                  attrs[primary] = getattr(model, primary)
                  if not primary_is_numeric:
                      if sys.version < '3':
                          attrs[primary] = unicode(attrs[primary])
                      else:
                          attrs[primary] = str(attrs[primary])
  
  
          mwh = ModelWhoosheer
  
          def inner(model):
              mwh.index_subdir = model.__tablename__
              mwh.models = [model]
  
              schema_attrs = {}
              for field in model.__table__.columns:
                  if field.primary_key:
                      primary = field.name
                      primary_is_numeric = True
                      if isinstance(field.type, SQLInteger):
                          schema_attrs[field.name] = whoosh.fields.NUMERIC(stored=True, unique=True)
                      else:
                          primary_is_numeric = False
                          schema_attrs[field.name] = whoosh.fields.ID(stored=True, unique=True)
                  elif field.name in index_fields:
                      schema_attrs[field.name] = whoosh.fields.TEXT(**kw)
              mwh.schema = whoosh.fields.Schema(**schema_attrs)
              # we can't check with isinstance, because ModelWhoosheer is private
              # so use this attribute to find out
              mwh._is_model_whoosheer = True
  
              @classmethod
              def update_model(cls, writer, model):
                  attrs = {}
                  cls._assign_primary(primary, primary_is_numeric, attrs, model)
                  for f in index_fields:
                      attrs[f] = getattr(model, f)
                      if not isinstance(attrs[f], int):
                          if sys.version < '3':
                              attrs[f] = unicode(attrs[f])
                          else:
                              attrs[f] = str(attrs[f])
                  writer.update_document(**attrs)
  
              @classmethod
              def insert_model(cls, writer, model):
                  attrs = {}
                  cls._assign_primary(primary, primary_is_numeric, attrs, model)
                  for f in index_fields:
                      attrs[f] = getattr(model, f)
                      if not isinstance(attrs[f], int):
                          if sys.version < '3':
                              attrs[f] = unicode(attrs[f])
                          else:
                              attrs[f] = str(attrs[f])
                  writer.add_document(**attrs)
  
              @classmethod
              def delete_model(cls, writer, model):
                  writer.delete_by_term(primary, getattr(model, primary))
  
              setattr(mwh, '{0}_{1}'.format(UPDATE_KWD, model.__name__.lower()), update_model)
              setattr(mwh, '{0}_{1}'.format(INSERT_KWD, model.__name__.lower()), insert_model)
              setattr(mwh, '{0}_{1}'.format(DELETE_KWD, model.__name__.lower()), delete_model)
              model._whoosheer_ = mwh
              model.whoosh_search = mwh.search
              self.register_whoosheer(mwh)
              return model
  
          return inner