Skip to content

Commit

Permalink
♻️ refactor: Handle _lastUpdated parameter specialy to improve search…
Browse files Browse the repository at this point in the history
… performance (get rid of unnecessary range querying due to FHIR data search mechanism, as onfhir always set lastUpdated in millisecond precision)
  • Loading branch information
Tuncay Namli committed Aug 29, 2024
1 parent ecc6272 commit 47cf99f
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,19 @@ object PrefixModifierHandler {

//If it is a datetime or instant base query
if(value.contains("T")){
// Build dateTime query on date time and period query on implicit ranges and combine them.
or(dateTimeQueryBuilder(FHIRUtil.mergeElementPath(path,FHIR_EXTRA_FIELDS.TIME_TIMESTAMP), prefix, implicitRanges), periodQueryBuilder(rangePaths, prefix, implicitRanges))
//We handle this specially as onfhir store this in millisecond precision
if(path == "meta.lastUpdated")
dateTimeQueryBuilder(FHIRUtil.mergeElementPath(path,FHIR_EXTRA_FIELDS.TIME_TIMESTAMP), prefix, implicitRanges)
else
// Build dateTime query on date time and period query on implicit ranges and combine them.
or(dateTimeQueryBuilder(FHIRUtil.mergeElementPath(path,FHIR_EXTRA_FIELDS.TIME_TIMESTAMP), prefix, implicitRanges), periodQueryBuilder(rangePaths, prefix, implicitRanges))
} else {
//If it is year, year-month, or date query
//Query over the sub date field
or(dateQueryBuilder(FHIRUtil.mergeElementPath(path,FHIR_EXTRA_FIELDS.TIME_DATE), prefix, implicitRanges), periodQueryBuilder(rangePaths, prefix, implicitRanges))
if(path == "meta.lastUpdated")
dateQueryBuilder(FHIRUtil.mergeElementPath(path,FHIR_EXTRA_FIELDS.TIME_DATE), prefix, implicitRanges)
else
//If it is year, year-month, or date query
//Query over the sub date field
or(dateQueryBuilder(FHIRUtil.mergeElementPath(path,FHIR_EXTRA_FIELDS.TIME_DATE), prefix, implicitRanges), periodQueryBuilder(rangePaths, prefix, implicitRanges))
}
}

Expand Down

0 comments on commit 47cf99f

Please sign in to comment.