Add search limits

This commit is contained in:
2021-12-10 15:40:07 +03:00
parent 7e825d099b
commit 962650175e
3 changed files with 11 additions and 8 deletions

View File

@@ -3,7 +3,7 @@ from app.models import Author
from app.services.common import TRGMSearchService
GET_OBJECTS_IDS_QUERY = """
GET_OBJECT_IDS_QUERY = """
SELECT ARRAY(
WITH filtered_authors AS (
SELECT
@@ -32,6 +32,7 @@ SELECT ARRAY(
)
SELECT fauthors.id FROM filtered_authors as fauthors
ORDER BY fauthors.sml DESC, fauthors.books_count DESC
LIMIT 210
);
"""
@@ -39,4 +40,4 @@ SELECT ARRAY(
class AuthorTGRMSearchService(TRGMSearchService):
MODEL_CLASS = Author
PREFETCH_RELATED = ["source", "annotations"]
GET_OBJECT_IDS_QUERY = GET_OBJECTS_IDS_QUERY
GET_OBJECT_IDS_QUERY = GET_OBJECT_IDS_QUERY