'Extracts indexable attributes from an Answer.'

@classmethod
def extract_document(cls, obj_id, obj=None):

    fields = ['id', 'created', 'creator_id', 'reviewed', 'reviewer_id', 'is_approved', 'document_id']
    composed_fields = ['document__locale', 'document__slug']
    all_fields = (fields + composed_fields)
    if (obj is None):
        model = cls.get_model()
        obj_dict = model.objects.values(*all_fields).get(pk=obj_id)
    else:
        obj_dict = dict([(field, getattr(obj, field)) for field in fields])
        obj_dict['document__locale'] = obj.document.locale
        obj_dict['document__slug'] = obj.document.slug
    d = {}
    d['id'] = obj_dict['id']
    d['model'] = cls.get_mapping_type_name()
    d['url'] = reverse('wiki.revision', kwargs={'revision_id': obj_dict['id'], 'document_slug': obj_dict['document__slug']})
    d['indexed_on'] = int(time.time())
    d['created'] = obj_dict['created']
    d['reviewed'] = obj_dict['reviewed']
    d['locale'] = obj_dict['document__locale']
    d['is_approved'] = obj_dict['is_approved']
    d['creator_id'] = obj_dict['creator_id']
    d['reviewer_id'] = obj_dict['reviewer_id']
    doc = Document.objects.get(id=obj_dict['document_id'])
    d['product'] = [p.slug for p in doc.get_products()]
    return d
