Populate the indexes
559344
public function populateIndex()
    {
        $this->buildDocumentsByManager($this->doctrine);

        if ($this->mongo) {
            $this->buildDocumentsByManager($this->mongo);
        }

        if (!empty($this->documents)) {
            $response = $this->searchProvider->addDocuments($this->documents);
            $this->documents = [];
        }
    }
1155204
private function populate() {
	
		$res = Database::load('SELECT * FROM `options` ORDER BY `group`');
			
		$this->list = array();
			
		foreach ($res as $o) {
			
			// esplode le options
			if ('list'==$o->type) {
				
				$listItems = explode('|', $o->list_options);
				
				foreach ($listItems as $listEntry) {
					
					list ($val,$text)	= explode(',', $listEntry);
					
					$listItem = new \stdClass();
					
					$listItem->value = $val;
					$listItem->text  = $text;
					
					$o->listItems[] = $listItem;
					
				}
				
			}

			// casting
			$o->value = $this->castTo($o->value, $o->type);
			
			$this->list[$o->name] = $o;
			
		}
	
	}
689106
def init_index(self, app=None):
        """"""
        elasticindexes = self._get_indexes()

        for index, settings in elasticindexes.items():
            es = settings['resource']
            if not es.indices.exists(index):
                self.create_index(index, settings.get('index_settings'), es)
                continue
            else:
                self.put_settings(app, index, settings.get('index_settings').get('settings'), es)

            for mapping_type, mappings in settings.get('index_settings', {}).get('mappings').items():
                self._put_resource_mapping(mapping_type, es,
                                           properties=mappings,
                                           index=index, doc_type=mapping_type)
        return
849847
def populate_all():
    """"""
    ReceiptType.objects.populate()
    ConceptType.objects.populate()
    DocumentType.objects.populate()
    VatType.objects.populate()
    TaxType.objects.populate()
    CurrencyType.objects.populate()
162014
def _create_indexes(self):
        """"""
        # WARNING: The collection will be locked during the index
        # creation. If the collection has a large number of
        # documents in it, the operation can take a long time.

        # TODO: The creation of indexes can be moved to a Django
        # management command or equivalent. There is also an option to
        # run the indexing on the background, without locking.
        self.collection.ensure_index([('time', pymongo.DESCENDING)])
        self.collection.ensure_index('name')
316613
public function populate($rows): array
    {
        $result = [];

        if ($this->indexBy === null) {
            return array_values($rows); // reset storage internal keys
        }

        foreach ($rows as $row) {
            if (is_string($this->indexBy)) {
                $key = $row[$this->indexBy];
            } else {
                $key = call_user_func($this->indexBy, $row);
            }
            $result[$key] = $row;
        }

        return $result;
    }
1292834
public function setIndexes(array $indexes)
    {
        $this->indexes = array();

        foreach ($indexes as $index) {
            $this->addIndex($index);
        }
    }
713191
def populate_values(self):
        '''
        
        '''
        obj = self._get_base_state()
        self.base_state = json.dumps(obj)
779403
def update_index(self, key, value):
        ""
        for k, v in value.items():
            if k in self.indexes:
                # A non-string index value switches it into a lazy one.
                if not isinstance(v, six.string_types):
                    self.index_defs[k]['type'] = 'lazy'
                if v not in self.indexes[k]:
                    self.indexes[k][v] = set([])
                self.indexes[k][v].add(key)
604647
def collect(self):
        """"""
        local_df = self._schema_rdd.toPandas()
        correct_idx_df = _update_index_on_df(local_df, self._index_names)
        return correct_idx_df
1266628
def _add_to_indices(self, pipeline):
        """"""
        for att in self.indices:
            self._add_to_index(att, pipeline=pipeline)
1115797
def update_indexes_after(start_index)
      size = @templates.size
      if size > 0
        start_index.upto(size - 1) do |index|
          @templates[index].context.locals[:_index=].call(index)
        end
      end
    end
90488
private function populateOptions()
    {
        $flatOptions = $this->getRawOptions();

        $this->parser->parseInput($flatOptions);

        $parsed = $this->parser->getOptions();

        foreach ($parsed as $optionName => $optionValue) {
            //ignores any options the user sent which were not defined
            $this->options->setValueIfExists($optionName, $optionValue);
        }
    }
784047
function getIndexes(done, results) {
  var client = results.client;
  var ns = mongodbNS(results.namespace);
  client
    .db(ns.database)
    .collection(ns.collection)
    .indexes(function(err, indexes) {
      if (err) {
        done(err);
      }
      // add ns field to each index
      _.each(indexes, function(idx) {
        idx.ns = ns.ns;
      });
      done(null, indexes);
    });
}
871507
private void createIndex() {
        try {
            client.createIndex(name(), workspace, columns.mappings(workspace));
            client.flush(name());
        } catch (IOException e) {
            throw new EsIndexException(e);
        }
    }
1020673
def _get_indexes(self, schema, **kwargs):
        """"""
        ret = {}
        query_str = []
        query_str.append('SELECT')
        query_str.append('  tbl.relname AS table_name, i.relname AS index_name, a.attname AS field_name,')
        query_str.append('  ix.indkey AS index_order, a.attnum AS field_num')
        query_str.append('FROM')
        query_str.append('  pg_class tbl, pg_class i, pg_index ix, pg_attribute a')
        query_str.append('WHERE')
        query_str.append('  tbl.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = tbl.oid')
        query_str.append('  AND a.attnum = ANY(ix.indkey) AND tbl.relkind = %s AND tbl.relname = %s')
        query_str.append('ORDER BY')
        query_str.append('  tbl.relname, i.relname')
        query_str = os.linesep.join(query_str)

        indexes = self.query(query_str, 'r', str(schema), **kwargs)

        # massage the data into more readable {index_name: fields} format
        for idict in indexes:
            if idict['index_name'] not in ret:
                ret[idict['index_name']] = list(map(int, idict['index_order'].split(' ')))

            i = ret[idict['index_name']].index(idict['field_num'])
            ret[idict['index_name']][i] = idict['field_name']

        return ret
595181
def _put_into_indexes(self, obj):
        
        no_of_used_indexes = 0
        for field_name, db_index in list(self._get_db_fields(obj)):
            attr_value = getattr(obj, field_name)

            if attr_value is None:  # index only by set attributes
                continue

            container = db_index.get(attr_value, None)
            if container is None:
                container = OOTreeSet()
                db_index[attr_value] = container

            container.insert(obj)

            no_of_used_indexes += 1

        # make sure that atleast one `attr_value` was used
        if no_of_used_indexes <= 0:
            raise UnindexableObject(
                "You have to use atleast one of the identificators!"
            )