Skip to content

Commit fa8d107

Browse files
fix(graphql): filter HEAD search by latest concept versions (#815)
* fix(graphql): filter HEAD search by latest concept versions * fix(graphql): serialize concepts in sync thread * chore: revert to docker compose default changes
1 parent 8a2038a commit fa8d107

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/graphql/queries.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,10 @@ def concept_ids_from_es(
361361
search = ConceptDocument.search()
362362
if source_version:
363363
search = search.filter('term', source=source_version.mnemonic.lower())
364-
search = search.filter('term', source_version=source_version.version)
364+
if source_version.is_head:
365+
search = search.filter('term', is_latest_version=True)
366+
else:
367+
search = search.filter('term', source_version=source_version.version)
365368
search = search.filter('term', retired=False)
366369

367370
should_queries = [
@@ -505,6 +508,7 @@ async def concepts( # pylint: disable=too-many-arguments,too-many-locals
505508
mapping_prefetch,
506509
)
507510

511+
serialized = await sync_to_async(serialize_concepts)(concepts)
508512
return ConceptSearchResult(
509513
org=org,
510514
source=source,
@@ -513,5 +517,5 @@ async def concepts( # pylint: disable=too-many-arguments,too-many-locals
513517
limit=pagination['limit'] if pagination else None,
514518
total_count=total,
515519
has_next_page=has_next(total, pagination),
516-
results=serialize_concepts(concepts),
520+
results=serialized,
517521
)

0 commit comments

Comments
 (0)