@@ -100,23 +100,23 @@ Also supports `Sum`
100
100
Add an approximate index
101
101
102
102
``` python
103
- from pgvector.django import IvfflatIndex, HnswIndex
103
+ from pgvector.django import HnswIndex, IvfflatIndex
104
104
105
105
class Item (models .Model ):
106
106
class Meta :
107
107
indexes = [
108
- IvfflatIndex (
108
+ HnswIndex (
109
109
name = ' my_index' ,
110
110
fields = [' embedding' ],
111
- lists = 100 ,
111
+ m = 16 ,
112
+ ef_construction = 64 ,
112
113
opclasses = [' vector_l2_ops' ]
113
114
),
114
115
# or
115
- HnswIndex (
116
+ IvfflatIndex (
116
117
name = ' my_index' ,
117
118
fields = [' embedding' ],
118
- m = 16 ,
119
- ef_construction = 64 ,
119
+ lists = 100 ,
120
120
opclasses = [' vector_l2_ops' ]
121
121
)
122
122
]
@@ -183,14 +183,14 @@ Add an approximate index
183
183
184
184
``` python
185
185
index = Index(' my_index' , Item.embedding,
186
- postgresql_using = ' ivfflat ' ,
187
- postgresql_with = {' lists ' : 100 },
186
+ postgresql_using = ' hnsw ' ,
187
+ postgresql_with = {' m ' : 16 , ' ef_construction ' : 64 },
188
188
postgresql_ops = {' embedding' : ' vector_l2_ops' }
189
189
)
190
190
# or
191
191
index = Index(' my_index' , Item.embedding,
192
- postgresql_using = ' hnsw ' ,
193
- postgresql_with = {' m ' : 16 , ' ef_construction ' : 64 },
192
+ postgresql_using = ' ivfflat ' ,
193
+ postgresql_with = {' lists ' : 100 },
194
194
postgresql_ops = {' embedding' : ' vector_l2_ops' }
195
195
)
196
196
0 commit comments