Skip to content

Commit a7a9e2c

Browse files
committed
Test add index
1 parent 9d710b5 commit a7a9e2c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tests/test_django.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from django.db import connection, migrations, models
44
from django.db.migrations.loader import MigrationLoader
55
import numpy as np
6+
import pgvector.django
67
from pgvector.django import VectorExtension, VectorField, IvfflatIndex, L2Distance, MaxInnerProduct, CosineDistance
78

89
settings.configure(
@@ -43,8 +44,12 @@ class Migration(migrations.Migration):
4344
name='Item',
4445
fields=[
4546
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
46-
('factors', VectorField(dimensions=3)),
47+
('factors', pgvector.django.VectorField(dimensions=3)),
4748
],
49+
),
50+
migrations.AddIndex(
51+
model_name='item',
52+
index=pgvector.django.IvfflatIndex(fields=['factors'], lists=1, name='my_index', opclasses=['vector_l2_ops']),
4853
)
4954
]
5055

0 commit comments

Comments
 (0)