Skip to content

Commit

Permalink
Remove object_key field from Document
Browse files Browse the repository at this point in the history
  • Loading branch information
tomusher committed Sep 13, 2024
1 parent df0ca23 commit dc7072f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ class Migration(migrations.Migration):
model_name="document",
name="object_id",
),
migrations.AddField(
model_name="document",
name="object_key",
field=models.CharField(max_length=255),
),
migrations.AddField(
model_name="document",
name="object_keys",
Expand Down
4 changes: 2 additions & 2 deletions src/wagtail_vector_index/storage/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def for_keys(self, object_keys: list[str]):
class Document(models.Model):
"""Stores an embedding for an arbitrary chunk"""

object_key = models.CharField(max_length=255)
object_keys = models.JSONField(default=list)
vector = models.JSONField()
content = models.TextField()
Expand All @@ -38,7 +37,8 @@ class Document(models.Model):
objects = DocumentQuerySet.as_manager()

def __str__(self):
return f"Document for {self.object_key}"
keys = ", ".join(self.object_keys)
return f"Document for {keys}"

@classmethod
def from_keys(cls, object_keys: list[str]) -> "Document":
Expand Down

0 comments on commit dc7072f

Please sign in to comment.