inner-search-3
Some checks failed
Deploy to core / deploy (push) Has been cancelled

This commit is contained in:
2024-01-29 04:41:46 +03:00
parent 2663d1cbc5
commit e1a27b55cd
4 changed files with 28 additions and 46 deletions

View File

@@ -11,7 +11,7 @@ from services.auth import login_required
from services.db import local_session
from services.notify import notify_shout
from services.schema import mutation, query
from services.search import SearchService
from services.search import search
@query.field('get_shouts_drafts')
@@ -82,9 +82,6 @@ async def create_shout(_, info, inp):
# notifier
await notify_shout(shout_dict, 'create')
# search service indexing
SearchService.elastic.index_post(shout)
return {'shout': shout_dict}
@@ -190,9 +187,9 @@ async def update_shout( # noqa: C901
if not publish:
await notify_shout(shout_dict, 'update')
# search service indexing
SearchService.elastic.index_post(shout)
if shout.visibility is ShoutVisibility.COMMUNITY.value or shout.visibility is ShoutVisibility.PUBLIC.value:
# search service indexing
search.index_post(shout)
return {'shout': shout_dict}

View File

@@ -14,7 +14,7 @@ from resolvers.topic import get_random_topic
from services.auth import login_required
from services.db import local_session
from services.schema import query
from services.search import SearchService
from services.search import search_text
from services.viewed import ViewedStorage
@@ -312,7 +312,7 @@ async def load_shouts_feed(_, info, options):
@query.field('load_shouts_search')
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 = await search_text(text, limit, offset)
results_dict = {r['slug']: r for r in results}
found_keys = list(results_dict.keys())