Ejemplo n.º 1
0
    def __init__(self, collection='entities'):
        AMongoCollection.__init__(self, collection=collection, primary_key='entity_id', overflow=True)
        AEntityDB.__init__(self)

        fast_resolve_fields = ('sources.amazon_id', 'sources.spotify_id', 'sources.rdio_id',
                'sources.opentable_id', 'sources.tmdb_id', 'sources.factual_id', 'sources.instagram_id',
                'sources.singleplatform_id', 'sources.foursquare_id', 'sources.fandango_id', 'sources.googleplaces_id',
                'sources.itunes_id', 'sources.netflix_id', 'sources.thetvdb_id', 'sources.nytimes_id',
                'sources.umdmusic_id', 'sources.tombstone_id')
        for field in fast_resolve_fields:
            self._collection.ensure_index(field)

        self._collection.ensure_index([
                                    ('search_tokens',               pymongo.ASCENDING),
                                    ('sources.user_generated_id',   pymongo.ASCENDING),
                                    ('sources.tombstone_id',        pymongo.ASCENDING),
                                ])

        self._collection.ensure_index('search_tokens')
        self._collection.ensure_index('titlel')
        self._collection.ensure_index('albums.title')
        self._collection.ensure_index('artists.title')
        self._collection.ensure_index('authors.title')
        self._collection.ensure_index('tracks.title')

        self._collection.ensure_index([('_id', pymongo.ASCENDING), ('sources.user_generated_id', pymongo.ASCENDING)])

        self._cache = globalMemcache()
Ejemplo n.º 2
0
 def __init__(self, collection='entities'):
     AMongoCollection.__init__(self, collection='seedentities', primary_key='entity_id', overflow=True)
     AEntityDB.__init__(self)