@classmethod
    def extract_document(cls, obj_id, obj=None):
        if obj is None:
            model = cls.get_model()
            obj = model.objects.select_related('user').get(pk=obj_id)

        if not obj.user.is_active:
            raise UnindexMeBro()

        d = {}
        d['id'] = obj.pk
        d['model'] = cls.get_mapping_type_name()
        d['url'] = obj.get_absolute_url()
        d['indexed_on'] = int(time.time())

        d['username'] = obj.user.username
        d['display_name'] = obj.display_name
        d['twitter_usernames'] = obj.twitter_usernames

        d['last_contribution_date'] = obj.last_contribution_date

        d['iusername'] = obj.user.username.lower()
        d['idisplay_name'] = obj.display_name.lower()
        d['itwitter_usernames'] = [u.lower() for u in obj.twitter_usernames]

        from kitsune.users.templatetags.jinja_helpers import profile_avatar
        d['avatar'] = profile_avatar(obj.user, size=120)

        d['suggest'] = {
            'input': [
                d['iusername'],
                d['idisplay_name']
            ],
            'output': _(u'{displayname} ({username})').format(
                displayname=d['display_name'], username=d['username']),
            'payload': {'user_id': d['id']},
        }

        return d
Extracts interesting thing from a Thread and its Posts
dataset/ETHPy150Open mozilla/kitsune/kitsune/users/models.py/UserMappingType.extract_document