Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref/#2540-Move Search Logic from Search.execute() to FhirEngine.search() #2541

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
spotless apply
  • Loading branch information
itstanany committed May 12, 2024
commit 753dbca3321dc3c742851e054f0cc38d4e970f28
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Google LLC
* Copyright 2023-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ internal class FhirEngineImpl(private val database: Database, private val contex
} else {
database.searchReverseReferencedResources(
search.getRevIncludeQuery(
includeIds = baseResources.map { "${it.resource.resourceType}/${it.resource.logicalId}" },
includeIds =
baseResources.map { "${it.resource.resourceType}/${it.resource.logicalId}" },
),
)
}
Expand All @@ -87,17 +88,17 @@ internal class FhirEngineImpl(private val database: Database, private val contex
SearchResult(
baseResource,
included =
includedResources
?.asSequence()
?.filter { it.baseResourceUUID == uuid }
?.groupBy({ it.searchIndex }, { it.resource }),
includedResources
?.asSequence()
?.filter { it.baseResourceUUID == uuid }
?.groupBy({ it.searchIndex }, { it.resource }),
revIncluded =
revIncludedResources
?.asSequence()
?.filter {
it.baseResourceTypeWithId == "${baseResource.fhirType()}/${baseResource.logicalId}"
}
?.groupBy({ it.resource.resourceType to it.searchIndex }, { it.resource }),
revIncludedResources
?.asSequence()
?.filter {
it.baseResourceTypeWithId == "${baseResource.fhirType()}/${baseResource.logicalId}"
}
?.groupBy({ it.resource.resourceType to it.searchIndex }, { it.resource }),
)
}
}
Expand Down