def METHOD_NAME(self):
    self.ensure_one()
    if not self._install_trgm_extension():
        raise exceptions.UserError(
            _("The pg_trgm extension does not exists or cannot be installed.")
        )
    table_name = self.env[self.field_id.model_id.model]._table
    column_name = self.field_id.name
    index_type = self.index_type
    index_name = "{}_{}_idx".format(column_name, index_type)
    index_exists, index_name = self.get_not_used_index(index_name, table_name)
    if not index_exists:
        self.env.cr.execute(
            """
        CREATE INDEX %(index)s
        ON %(table)s
        USING %(indextype)s (%(column)s %(indextype)s_trgm_ops);
        """,
            {
                "table": AsIs(table_name),
                "index": AsIs(index_name),
                "column": AsIs(column_name),
                "indextype": AsIs(index_type),
            },
        )
    return index_name