-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support building vector index with django_tidb>=5.0.1 #64
Conversation
Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest looks good!
embedding = VectorField(dimensions=3, db_comment="hnsw(distance=cosine)") | ||
class Meta: | ||
indexes = [ | ||
VectorIndex(L2Distance("embedding"), name='idx_l2'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to omit the name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, according to the django.db.models.Index
, the user must set the name for an expression index in django
https://github.com/django/django/blob/69bf08e3a32492998871eb91ad84b3c8d8117180/django/db/models/indexes.py#L47-L48
Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
@wd0517 PTAL |
Depends on the django-tidb update: pingcap/django-tidb#67
Update the example of using django with vector-index: