searchable
All checks were successful
Deploy on push / deploy (push) Successful in 4m21s

This commit is contained in:
2024-02-25 16:43:04 +03:00
parent 4b83f5d0f5
commit 2222f6fc19
5 changed files with 40 additions and 65 deletions

View File

@@ -1,8 +1,9 @@
import json
import time
from sqlalchemy import desc, select, or_, and_, func
from sqlalchemy import desc, select, or_, and_
from sqlalchemy.orm import aliased
from sqlalchemy_searchable import search
from orm.author import Author, AuthorFollower
from orm.shout import ShoutAuthor, ShoutTopic
@@ -212,9 +213,5 @@ def get_author_followers(_, _info, slug: str):
@query.field('search_authors')
def search_authors(_, info, text: str):
v1 = func.to_tsquery('russian', text)
v2 = func.to_tsvector(
'russian', Author.name or ' ' or Author.bio or ' ' or Author.about
)
q = select(Author).filter(v2.match(v1))
q = search(select(Author), text)
return get_with_stat(q)