We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent afcd67a commit 441b26eCopy full SHA for 441b26e
README.md
@@ -142,12 +142,16 @@ from django.contrib.postgres.indexes import OpClass
142
from django.db.models.functions import Cast
143
from pgvector.django import HalfVectorField
144
145
-index = HnswIndex(
146
- OpClass(Cast('embedding', HalfVectorField(dimensions=3)), name='halfvec_l2_ops'),
147
- name='my_index',
148
- m=16,
149
- ef_construction=64
150
-)
+class Item(models.Model):
+ class Meta:
+ indexes = [
+ HnswIndex(
+ OpClass(Cast('embedding', HalfVectorField(dimensions=3)), name='halfvec_l2_ops'),
+ name='my_index',
151
+ m=16,
152
+ ef_construction=64
153
+ )
154
+ ]
155
```
156
157
Note: Add `'django.contrib.postgres'` to `INSTALLED_APPS` to use `OpClass`
0 commit comments