dossier/store/store.py
def _index_keys_for(self, idx_name, *ids_and_fcs):
        '''Returns a generator of index triples.

        Returns a generator of index keys for the ``ids_and_fcs`` pairs
        given. The index keys have the form ``(idx_name, idx_val,
        content_id)``.

        :type idx_name: unicode
        :type ids_and_fcs: ``[(content_id, FeatureCollection)]``
        :rtype: generator of ``(str, str, str)``
        '''
        idx = self._index(idx_name)
        icreate, itrans = idx['create'], idx['transform']
        if isinstance(idx_name, unicode):
            idx_name = idx_name.encode('utf-8')

        for cid_fc in ids_and_fcs:
            content_id = cid_fc[0]

            # Be sure to dedup index_values or else we may
            # suffer duplicate_pkey errors down the line.
            seen_values = set()
            for index_value in icreate(itrans, cid_fc):
                if index_value and index_value not in seen_values:
                    yield (index_value, idx_name, content_id)
                    seen_values.add(index_value)
def _index_keys_for(self, idx_name, *ids_and_fcs):
        '''Returns a generator of index triples.

        Returns a generator of index keys for the ``ids_and_fcs`` pairs
        given. The index keys have the form ``(idx_name, idx_val,
        content_id)``.

        :type idx_name: unicode
        :type ids_and_fcs: ``[(content_id, FeatureCollection)]``
        :rtype: generator of ``(str, str, str)``
        '''
        idx = self._index(idx_name)
        icreate, itrans = idx['create'], idx['transform']
        if isinstance(idx_name, unicode):
            idx_name = idx_name.encode('utf-8')

        for cid_fc in ids_and_fcs:
            content_id = cid_fc[0]

            # Be sure to dedup index_values or else we may
            # suffer duplicate_pkey errors down the line.
            seen_values = set()
            for index_value in icreate(itrans, cid_fc):
                if index_value and index_value not in seen_values:
                    yield (index_value, idx_name, content_id)
                    seen_values.add(index_value)
Returns a generator of index triples.

        Returns a generator of index keys for the ``ids_and_fcs`` pairs
        given. The index keys have the form ``(idx_name, idx_val,
        content_id)``.

        :type idx_name: unicode
        :type ids_and_fcs: ``[(content_id, FeatureCollection)]``
        :rtype: generator of ``(str, str, str)``