@@ -100,23 +100,23 @@ Also supports `Sum`
100100Add an approximate index
101101
102102``` python
103- from pgvector.django import IvfflatIndex, HnswIndex
103+ from pgvector.django import HnswIndex, IvfflatIndex
104104
105105class Item (models .Model ):
106106 class Meta :
107107 indexes = [
108- IvfflatIndex (
108+ HnswIndex (
109109 name = ' my_index' ,
110110 fields = [' embedding' ],
111- lists = 100 ,
111+ m = 16 ,
112+ ef_construction = 64 ,
112113 opclasses = [' vector_l2_ops' ]
113114 ),
114115 # or
115- HnswIndex (
116+ IvfflatIndex (
116117 name = ' my_index' ,
117118 fields = [' embedding' ],
118- m = 16 ,
119- ef_construction = 64 ,
119+ lists = 100 ,
120120 opclasses = [' vector_l2_ops' ]
121121 )
122122 ]
@@ -183,14 +183,14 @@ Add an approximate index
183183
184184``` python
185185index = 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 },
188188 postgresql_ops = {' embedding' : ' vector_l2_ops' }
189189)
190190# or
191191index = 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 },
194194 postgresql_ops = {' embedding' : ' vector_l2_ops' }
195195)
196196
0 commit comments