def index_media(media): body = ' '.join([ media.metadata.get('title', ''), media.metadata.get('description', ''), media.metadata.get('author', ''), ]) index_doc(solr_config(media), media, path='/'.join(nodepath(media)), repository=media.__parent__.metadata.title, type='Media', body=body)
def index_revision(revision): path = '/'.join(nodepath(revision)) physical_path = '/'.join(nodepath(revision.model)) try: size = os.path.getsize('%s.binary' % physical_path) except OSError: size = 0 body = ' '.join([ revision.metadata.get('title', ''), revision.metadata.get('description', ''), revision.metadata.get('author', ''), revision.metadata.get('alttag', ''), ', '.join(revision.metadata.get('keywords', [])), ]) mimetype = revision.metadata.get('mimetype', '') index_doc(solr_config(revision), revision, type='Revision', mimetype=mimetype, revision=revision.model.__name__, path=path, physical_path=physical_path, size=size, body=body)