Start add a Index in DDL, detail usage see demo
198712
public IndexModel index() {
		checkReadOnly();
		IndexModel index = new IndexModel();
		index.setTableModel(this);
		getIndexConsts().add(index);
		return index;
	}
828743
protected void runDDL(String ddl, boolean transformDdl) {
        String modifiedDdl = (transformDdl ? transformDDL(ddl) : ddl);
        printTransformedSql(ddl, modifiedDdl);
        super.runDDL(modifiedDdl);
    }
939175
public void addSearchIndex(I_CmsSearchIndex searchIndex) {

        if (!searchIndex.isInitialized()) {
            if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_2_INITIALIZING) {
                try {
                    searchIndex.initialize();
                } catch (CmsException e) {
                    // should never happen
                    LOG.error(e.getMessage(), e);
                }
            }
        }

        // name: not null or emtpy and unique
        String name = searchIndex.getName();
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(name)) {
            throw new CmsIllegalArgumentException(
                Messages.get().container(Messages.ERR_SEARCHINDEX_CREATE_MISSING_NAME_0));
        }
        if (m_indexSources.keySet().contains(name)) {
            throw new CmsIllegalArgumentException(
                Messages.get().container(Messages.ERR_SEARCHINDEX_CREATE_INVALID_NAME_1, name));
        }

        m_indexes.add(searchIndex);
        if (m_adminCms != null) {
            initOfflineIndexes();
        }

        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(
                Messages.get().getBundle().key(
                    Messages.INIT_ADD_SEARCH_INDEX_2,
                    searchIndex.getName(),
                    searchIndex.getProject()));
        }
    }
755316
function buildDocsIndex(dataPath, indexPath, done) {
  dataPath = dataPath || `${config.docsLocalPath}/search-data.json`;
  indexPath = indexPath || `${config.docsLocalPath}/search-index.json`;

  const documents = JSON.parse(fs.readFileSync(dataPath));

  // Generate index
  const idx = lunr(function () {
    this.ref('id');
    this.field('title');

    documents.forEach(function (doc) {
      this.add(doc);
    }, this);
  });

  const searchIndex = JSON.stringify(idx);

  // Save search index
  fs.writeFileSync(indexPath, searchIndex);

  done();
}
11927
def add_index(self, new_index, index_table):
    
    self.send_add_index(new_index, index_table)
    return self.recv_add_index()
272166
def create_indexes(clas,pool_or_cursor):
    ""
    for index in clas.INDEXES:
      # note: these are specified as either 'field,field,field' or a runnable query. you can put any query you want in there
      query = index if 'create index' in index.lower() else 'create index on %s (%s)'%(clas.TABLE,index)
      commit_or_execute(pool_or_cursor,query)
302505
def add_target_and_index(self, name_cls, sig, signode):
        
        modname = self.options.get(
            'module', self.env.temp_data.get('chpl:module'))
        fullname = (modname and modname + '.' or '') + name_cls[0]
        # note target
        if fullname not in self.state.document.ids:
            signode['names'].append(fullname)
            signode['ids'].append(fullname)
            signode['first'] = (not self.names)
            self.state.document.note_explicit_target(signode)
            objects = self.env.domaindata['chpl']['objects']
            if fullname in objects:
                self.state_machine.reporter.warning(
                    'duplicate object description of %s, ' % fullname +
                    'other instance in ' +
                    self.env.doc2path(objects[fullname][0]) +
                    ', use :noindex: for one of them',
                    line=self.lineno)
            objects[fullname] = (self.env.docname, self.objtype)

        indextext = self.get_index_text(modname, name_cls)
        if indextext:
            self.indexnode['entries'].append(('single', indextext,
                                              fullname, ''))
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
12160
def start_index(self):
        """"""
        paginator = self.paginator
        # Special case, return zero if no items.
        if paginator.count == 0:
            return 0
        elif self.number == 1:
            return 1
        return (
            (self.number - 2) * paginator.per_page + paginator.first_page + 1)
587815
def _add_index(self, index):
        
        index_name = index.get_name()
        index_name = self._normalize_identifier(index_name)
        replaced_implicit_indexes = []

        for name, implicit_index in self._implicit_indexes.items():
            if implicit_index.is_fullfilled_by(index) and name in self._indexes:
                replaced_implicit_indexes.append(name)

        already_exists = (
            index_name in self._indexes
            and index_name not in replaced_implicit_indexes
            or self._primary_key_name is not False
            and index.is_primary()
        )
        if already_exists:
            raise IndexAlreadyExists(index_name, self._name)

        for name in replaced_implicit_indexes:
            del self._indexes[name]
            del self._implicit_indexes[name]

        if index.is_primary():
            self._primary_key_name = index_name

        self._indexes[index_name] = index

        return self
1127038
public void registerIndexQuery(long index, Runnable query) {
    // Add a query to be run once the session's index reaches the given index.
    List<Runnable> queries = this.indexQueries.computeIfAbsent(index, v -> new LinkedList<>());
    queries.add(query);
  }
428139
def indexdelta(self, stop_id, start_id):
        
        return self.tokenid2index(stop_id) - self.tokenid2index(start_id)
1236797
def create_index(self, collection, index_name, **kwargs):
        """"""
        try:
            self.connection[collection].create_index(index_name, **kwargs)
        except Exception as exc:
            LOG.warn("Error tuning mongodb database: %s", exc)
420958
def create(index_name, body, force, verbose):
    """"""
    result = current_search_client.indices.create(
        index=index_name,
        body=json.load(body),
        ignore=[400] if force else None,
    )
    if verbose:
        click.echo(json.dumps(result))
1191521
private void addIndex(final String index) throws IOException {

        logger.info("Adding index '{}'...", index);

        String resourcePath = "/" + index;

        if (doesResourceNotExist(resourcePath)) {

            try {
                elasticSearchAdminClient.performRequest(HttpMethod.PUT, resourcePath);

                logger.info("Added '{}' index", index);
            } catch (ResponseException e) {

                boolean errorCreatingIndex = true;

                Response errorResponse = e.getResponse();
                if (errorResponse.getStatusLine().getStatusCode() == HttpStatus.SC_BAD_REQUEST) {
                    JsonNode root = objectMapper.readTree(EntityUtils.toString(errorResponse.getEntity()));
                    String errorCode = root.get("error").get("type").asText();
                    if ("index_already_exists_exception".equals(errorCode)) {
                        errorCreatingIndex = false;
                    }
                }

                if (errorCreatingIndex) {
                    throw e;
                }
            }
        } else {
            logger.info("Index '{}' already exists", index);
        }
    }
141036
def _insert(self, namespace, stream, events, configuration):
    
    index = self.index_manager.get_index(namespace)
    start_dts_to_add = set()

    def actions():
      for _id, event in events:
        dt = kronos_time_to_datetime(uuid_to_kronos_time(_id))
        start_dts_to_add.add(_round_datetime_down(dt))
        event['_index'] = index
        event['_type'] = stream
        event[LOGSTASH_TIMESTAMP_FIELD] = dt.isoformat()

        yield event

    list(es_helpers.streaming_bulk(self.es, actions(), chunk_size=1000,
                                   refresh=self.force_refresh))
    self.index_manager.add_aliases(namespace,
                                   index,
                                   start_dts_to_add)
1081376
public void add(final int currentArticleID, final long startTime,
			final long endTime, final List<ArticleIndexData> infoList)
	{

		// index_articleID_rc_ts
		if (!infoList.isEmpty()) {

			StringBuilder fullRevBuffer = new StringBuilder();
			StringBuilder revCountBuffer = new StringBuilder();

			boolean first = true;
			ArticleIndexData info;
			while (!infoList.isEmpty()) {

				info = infoList.remove(0);

				if (!first) {
					fullRevBuffer.append(" ");
					revCountBuffer.append(" ");
				}

				fullRevBuffer.append(info.getFullRevisionPrimaryKey());

				revCountBuffer.append(info.getStartRevisionCount());
				revCountBuffer.append(" ");
				revCountBuffer.append(info.getEndRevisionCount());

				first = false;
			}

			boolean sql = !insertStatement.isEmpty();
			if (buffer.length() + fullRevBuffer.length()
					+ revCountBuffer.length() + 20 >= MAX_ALLOWED_PACKET) {
				storeBuffer();
			}


			if(sql) {
				if (buffer.length() > insertStatement.length()) {
					buffer.append(",");
				}
				buffer.append("(");
			}
			buffer.append(currentArticleID);
			buffer.append(",");
			buffer.append(sql?"\'":"\"");
			buffer.append(fullRevBuffer);
			buffer.append(sql?"\'":"\"");
			buffer.append(",");
			buffer.append(sql?"\'":"\"");
			buffer.append(revCountBuffer);
			buffer.append(sql?"\'":"\"");
			buffer.append(",");
			buffer.append(startTime);
			buffer.append(",");
			buffer.append(endTime);
			if(sql) {
				buffer.append(")");
			}else{
				buffer.append("\n");
			}
		}
	}