scout/adapter/mongo/index.py
def load_indexes(self):
        """Add the proper indexes to the scout instance.

        All indexes are specified in scout/constants/indexes.py

        If this method is utilised when new indexes are defined those should be added

        """
        for collection_name in INDEXES:
            existing_indexes = self.indexes(collection_name)
            indexes = INDEXES[collection_name]
            for index in indexes:
                index_name = index.document.get('name')
                if index_name in existing_indexes:
                    LOG.info("Deleting old index: %s" % index_name)
                    self.db[collection_name].drop_index(index_name)
            LOG.info("creating indexes for {0} collection: {1}".format(
                collection_name,
                ', '.join([index.document.get('name') for index in indexes])
                ))
            self.db[collection_name].create_indexes(indexes)
def load_indexes(self):
        for collection_name in INDEXES:
            existing_indexes = self.indexes(collection_name)
            indexes = INDEXES[collection_name]
            for index in indexes:
                index_name = index.document.get('name')
                if index_name in existing_indexes:
                    LOG.info("Deleting old index: %s" % index_name)
                    self.db[collection_name].drop_index(index_name)
            LOG.info("creating indexes for {0} collection: {1}".format(
                collection_name,
                ', '.join([index.document.get('name') for index in indexes])
                ))
            self.db[collection_name].create_indexes(indexes)
def load_indexes ( self ) : for collection_name in INDEXES : existing_indexes = self . indexes ( collection_name ) indexes = INDEXES [ collection_name ] for index in indexes : index_name = index . document . get ( 'name' ) if index_name in existing_indexes : LOG . info ( "Deleting old index: %s" % index_name ) self . db [ collection_name ] . drop_index ( index_name ) LOG . info ( "creating indexes for {0} collection: {1}" . format ( collection_name , ', ' . join ( [ index . document . get ( 'name' ) for index in indexes ] ) ) ) self . db [ collection_name ] . create_indexes ( indexes )
Add the proper indexes to the scout instance.

        All indexes are specified in scout/constants/indexes.py

        If this method is utilised when new indexes are defined those should be added
Add the proper indexes to the scout instance .