This commit is contained in:
parent
c76e1625f3
commit
ec70549e48
|
@ -287,7 +287,7 @@ async def load_shouts_feed(_, info, options):
|
|||
async def load_shouts_search(_, _info, text, limit=50, offset=0):
|
||||
if text and len(text) > 2:
|
||||
results = await SearchService.search(text, limit, offset)
|
||||
results_dict = {[s.slug]: s for s in results} # { slug, title, score }
|
||||
results_dict = {[s["slug"]]: s for s in results} # { slug, title, score }
|
||||
q = (
|
||||
select(Shout) # Add "score" column
|
||||
.options(
|
||||
|
|
|
@ -21,6 +21,7 @@ class SearchService:
|
|||
async def search(text: str, limit: int = 50, offset: int = 0) -> List[Shout]:
|
||||
payload = []
|
||||
try:
|
||||
# TODO: add ttl for redis cached search results
|
||||
cached = await redis.execute("GET", text)
|
||||
|
||||
if not cached:
|
||||
|
|
Loading…
Reference in New Issue
Block a user