def update_vector(self, model, vector_field):
        vectors = []
        sql_fn = "setweight(to_tsvector(%s, COALESCE(%s, '')), '%s')"

        if not isinstance(vector_field, TSVectorField):
            raise AttributeError

        try:
            dict_field = model._meta.get_field_by_name(vector_field.dictionary)[0]
            dictionary = "%s::regconfig" % (
                dict_field.get_attname_column()[1])
        except:
            dictionary = "'%s'" % vector_field.dictionary

        for field, rank in vector_field._get_fields_and_ranks():
            vectors.append(sql_fn % (
                dictionary, field.get_attname_column()[1], rank))

        return self.sql_update_vector.format(
            model=model._meta.db_table,
            vector=vector_field.get_attname_column()[1],
            fields=' || '.join(vectors)
        )
dataset/ETHPy150Open dvdmgl/django-pg-fts/pg_fts/migrations.py/PgFtsSQL.update_vector/original