'Constructs a search item as a dictionary with title, content and URL'

def get_search_item(self):

    obj = self.get_related_object()
    if (not obj):
        obj = self
    item = {'id': u'', 'name': u'', 'type': unicode(obj.get_human_type()), 'content': u'', 'url': unicode(obj.get_absolute_url())}
    if obj.id:
        item['id'] = unicode(obj.id)
    if hasattr(obj, 'title'):
        item['name'] = unicode(obj.title)
    elif hasattr(obj, 'name'):
        item['name'] = unicode(obj.name)
    else:
        item['name'] = unicode(obj)
    if hasattr(self, 'body'):
        item['content'] = unicode(self.body)
    elif hasattr(self, 'details'):
        item['content'] = unicode(self.details)
    else:
        for field in self.get_fields():
            try:
                value = self.get_field_value(field.name)
                item['content'] += ('    ' + unicode(value))
            except:
                pass
    if hasattr(self, 'tags'):
        for tag in self.tags.all():
            item['content'] += ('    ' + unicode(tag))
    return item
