Optimize search queries

This commit is contained in:
2021-11-19 15:01:51 +03:00
parent 2cb808ec3c
commit 2a6950e2cf
3 changed files with 75 additions and 52 deletions

View File

@@ -79,7 +79,7 @@ class Sequence(ormar.Model):
source: Source = ormar.ForeignKey(Source, nullable=False)
remote_id: int = ormar.Integer(minimum=0, nullable=False) # type: ignore
name: str = ormar.String(max_length=256, nullable=False) # type: ignore
name: str = ormar.String(max_length=256, nullable=False, index=True) # type: ignore
class BookAuthors(ormar.Model):
@@ -129,7 +129,7 @@ class Book(ormar.Model):
source: Source = ormar.ForeignKey(Source, nullable=False)
remote_id: int = ormar.Integer(minimum=0, nullable=False) # type: ignore
title: str = ormar.String(max_length=256, nullable=False) # type: ignore
title: str = ormar.String(max_length=256, nullable=False, index=True) # type: ignore
lang: str = ormar.String(max_length=3, nullable=False) # type: ignore
file_type: str = ormar.String(max_length=4, nullable=False) # type: ignore
uploaded: date = ormar.Date() # type: ignore