This is essentially a workaround for not being able to define indexes on TEXT fields with the current version of Doctrine DBAL.
This feature will be removed when DBAL will support it, so don't use this feature.

@param array $textIndexes
424086
public function createTextIndexes(array $textIndexes)
    {
        if (!empty($textIndexes)) {
            $sm = $this->getSchemaManager();
            foreach ($textIndexes as $tableName => $indexes) {
                if ($sm->tablesExist([$tableName])) {
                    $existingIndexNames = array_map(
                        function (\Doctrine\DBAL\Schema\Index $index) {
                            return $index->getShortestName('');
                        },
                        $sm->listTableIndexes($tableName)
                    );
                    $chunks = [];
                    foreach ($indexes as $indexName => $indexColumns) {
                        if (!in_array(strtolower($indexName), $existingIndexNames, true)) {
                            $newIndexColumns = [];
                            foreach ((array) $indexColumns as $indexColumn) {
                                $indexColumn = (array) $indexColumn;
                                $s = $this->quoteIdentifier($indexColumn[0]);
                                if (!empty($indexColumn[1])) {
                                    $s .= '(' . (int) $indexColumn[1] . ')';
                                }
                                $newIndexColumns[] = $s;
                            }
                            $chunks[] = $this->quoteIdentifier($indexName) . ' (' . implode(', ', $newIndexColumns) . ')';
                        }
                    }
                    if (!empty($chunks)) {
                        $sql = 'ALTER TABLE ' . $this->quoteIdentifier($tableName) . ' ADD INDEX ' . implode(', ADD INDEX ', $chunks);
                        $this->executeQuery($sql);
                    }
                }
            }
        }
    }
701977
public function indexEntity(SearchableEntityInterface $entity)
    {
        foreach ($this->locales as $locale) {
            $this->addEntityToIndex($entity, $locale);
        }

        if (!empty($this->documents)) {
            $response = $this->searchProvider->addDocuments($this->documents);
            $this->documents = [];
        }
    }
53767
public function setExtensions($extensions)
    {
        $this->_extensions = array();
        $token             = ' ,;';
        $extension         = strtok($extensions, $token);

        while ($extension !== false) {
            $this->_extensions[] = $extension;
            $extension           = strtok($token);
        }

    }
850182
public function setIndex($index)
    {
        if ($this->index !== $index) {
            $this->index = $index;
            $this->addOrUpdate();
        }
    }
1060018
protected function findPrimaryKeyIndex(array $indexes) {
        foreach ($indexes as $index) {
            if ($index['type'] === Db::INDEX_PK) {
                return $index;
            }
        }
        return null;
    }
1374191
public function setModifiedIndices(array $modifiedIndices)
    {
        $this->modifiedIndices = [];
        foreach ($modifiedIndices as $indices) {
            list($fromIndex, $toIndex) = $indices;
            $this->addModifiedIndex($fromIndex->getName(), $fromIndex, $toIndex);
        }
    }
1002602
protected function parseCreateIndex(SQLTokenIterator $tokens)
    {

        /* @var $entity CreateIndexStatement */
        $entity = new CreateIndexStatement();

        ### FLAGS

        if ($tokens->isToken(SqlToken::T_UNIQUE(), TokenIterator::PREVIOUS, [SqlToken::T_PRIMARY()])) {
            $entity->setIsUnique(true);
        }

        if ($tokens->isToken(SqlToken::T_PRIMARY(), TokenIterator::PREVIOUS, [SqlToken::T_UNIQUE()])) {
            $entity->setIsPrimary(true);
        }

        ### NAME

        if (!$tokens->seekTokenNum(T_STRING)) {
            throw new MalformedSqlException("Missing valid index-name!", $tokens);
        }

        $entity->setName($tokens->getCurrentTokenString());

        ### USING

        if ($tokens->seekTokenNum(SqlToken::T_USING())) {
            switch(true){

                // TODO: R-TREE index not implemented yet!
                case $tokens->seekTokenNum(SqlToken::T_RTREE()):
                case $tokens->seekTokenNum(SqlToken::T_BTREE()):
                    $entity->setIndexType(IndexType::BTREE());
                    break;

                case $tokens->seekTokenNum(SqlToken::T_HASH()):
                    $entity->setIndexType(IndexType::HASH());
                    break;

                default:
                    throw new MalformedSqlException("Invalid index-type specified!", $tokens);
            }
        }

        ### TABLE

        if (!$tokens->seekTokenNum(SqlToken::T_ON())) {
            throw new MalformedSqlException("Missing T_ON for CREATE INDEX statement!", $tokens);
        }

        if (!$this->tableParser->canParseTokens($tokens)) {
            throw new MalformedSqlException("Missing valid table-specifier for CREATE INDEX statement!", $tokens);
        }

        $entity->setTable($this->tableParser->convertSqlToJob($tokens));

        ### COLUMNS

        if (!$tokens->seekTokenText('(')) {
            throw new MalformedSqlException("Missing beginning parenthesis holding columns in CREATE INDEX statement!", $tokens);
        }

        do {
            if (!$this->columnParser->canParseTokens($tokens)) {
                throw new MalformedSqlException("Missing valid column-specifier in CREATE INDEX statement!", $tokens);
            }

            $column = $this->columnParser->convertSqlToJob($tokens);

            $length = null;
            if ($tokens->seekTokenText('(')) {
                if (!$this->valueParser->canParseTokens($tokens)) {
                    throw new MalformedSqlException("Missing valid column-length in CREATE INDEX statement!", $tokens);
                }

                $length = $this->valueParser->convertSqlToJob($tokens);

                if (!$tokens->seekTokenText(')')) {
                    throw new MalformedSqlException("Missing closing parenthesis holding column-length in CREATE INDEX statement!", $tokens);
                }
            }

            $direction = null;
            if ($tokens->seekTokenNum(SqlToken::T_ASC())) {
                $direction = SqlToken::T_ASC();
            } elseif ($tokens->seekTokenNum(SqlToken::T_DESC())) {
                $direction = SqlToken::T_DESC();
            }

            $entity->addColumn($column, $length, $direction);

        } while ($tokens->seekTokenText(','));

        if (!$tokens->seekTokenText(')')) {
            throw new MalformedSqlException("Missing closing parenthesis holding columns in CREATE INDEX statement!", $tokens);
        }

        ### WITH PARSER

        if ($tokens->seekTokenNum(SqlToken::T_WITH())) {
            if (!$tokens->seekTokenNum(SqlToken::T_PARSER())) {
                throw new MalformedSqlException("Missing T_PARSER after T_WITH in CREATE INDEX statement!", $tokens);
            }

            if (!$tokens->seekTokenNum(T_STRING)) {
                throw new MalformedSqlException("Missing valid parser name after WITH PARSER in CREATE INDEX statement!", $tokens);
            }

            $entity->setParser($tokens->getCurrentTokenString());
        }

        return $entity;
    }
1048397
public function addNestedText($index, $text) {
      if (!($index <= sizeof($this->verbs))) {
        throw new \CatapultApiException("This verb does not have $index nested verbs");
      }
      $this->verbs[$index]->addText($text);
    }
1003893
public function addQuery($query, array $indexes)
    {
        if (empty($indexes)) {
            throw new EmptyIndexException('Try to search with empty indexes');
        }

        $this->sphinx->addQuery($query, implode(' ', $indexes));
    }
401684
public static function getRulesStartIndexes(array $arrayRulesIndexes): array
    {
        assert(array_key_exists(static::RULES_ARRAY_START_INDEXES, $arrayRulesIndexes));
        $result = $arrayRulesIndexes[static::RULES_ARRAY_START_INDEXES];

        return $result;
    }
599758
public function setIndex(Index $index)
    {
        if ($this->isEmbeddedDocument) {
            throw MappingException::embeddedDocumentsNotIndexable($this->getName());
        }

        if ($this->index !== null) {
            throw MappingException::indexExists($this->getName(), 'primary');
        }

        $this->index = $index;
    }
830882
public function withIndexes(array $indexes) : Table
    {
        return new self($this->name, $this->columns, $indexes, $this->foreignKeys);
    }
418735
private function setPrefixes( array $prefixes ) {
		foreach ( $prefixes as $prefix => $iri ) {
			$this->expressionValidator->validate( $prefix, ExpressionValidator::VALIDATE_PREFIX );
			$this->expressionValidator->validate( $iri, ExpressionValidator::VALIDATE_IRI );

			$this->prefixes[$prefix] = $iri;
		}

		$this->usageValidator->trackDefinedPrefixes( array_keys( $this->prefixes ) );
	}
69790
protected function bulkSend(array $documents)
    {
        try {
            $this->client->addDocuments($documents);
        } catch (ExceptionInterface $e) {
            if (!$this->options['ignore_error']) {
                throw new \RuntimeException("Error sending messages to Elasticsearch", 0, $e);
            }
        }
    }
1288889
protected function processFullTextIndex($ids)
    {
        $fullTextIndexer = $this->indexerRegistry->get(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID);

        if (!is_array($ids)) {
            $ids = [$ids];
        }

        $parentIds  = $this->fullIndexer->getRelationsByChild($ids);
        $processIds = $parentIds ? array_merge($parentIds, $ids) : $ids;

        if (!$fullTextIndexer->isScheduled()) {
            if (!empty($processIds)) {
                $fullTextIndexer->reindexList($processIds);
            }
        }
    }
635497
public function setCuries(array $curies)
    {
        if (empty($curies['name']) || empty($curies['href'])) {
            throw new MappingException('Curies must define "name" and "href" properties');
        }

        $this->curies = $curies;
    }
940837
protected function indexEdge(array $entity): void
    {
        //$tail_id = $entity[]
        $entity["attributes"]["udid"] = $entity["id"];
        $cq = sprintf("MATCH(t {udid: {tail}}), (h {udid: {head}}) MERGE (t)-[e:%s {udid: {udid}}]->(h) SET e = {data}", $entity["label"]);
        $result = $this->client->run($cq, [
            "tail" => $entity["tail"],
            "head" => $entity["head"],
            "udid" => $entity["id"],
            "data" => $entity["attributes"]
        ]);
    }