Class ExtendedHSearchClauseBuilder

java.lang.Object
ca.uhn.fhir.jpa.dao.search.ExtendedHSearchClauseBuilder

  • Field Details

  • Constructor Details

    • ExtendedHSearchClauseBuilder

      public ExtendedHSearchClauseBuilder(ca.uhn.fhir.context.FhirContext myFhirContext, StorageSettings theStorageSettings, org.hibernate.search.engine.search.predicate.dsl.BooleanPredicateClausesStep<?> theRootClause, org.hibernate.search.engine.search.predicate.dsl.SearchPredicateFactory thePredicateFactory)
  • Method Details

    • addResourceTypeClause

      public void addResourceTypeClause(String theResourceType)
      Restrict search to resources of a type
      Parameters:
      theResourceType - the type to match. e.g. "Observation"
    • addTokenUnmodifiedSearch

      public void addTokenUnmodifiedSearch(String theSearchParamName, List<List<ca.uhn.fhir.model.api.IQueryParameterType>> theAndOrTerms)
    • addStringTextSearch

      public void addStringTextSearch(String theSearchParamName, List<List<ca.uhn.fhir.model.api.IQueryParameterType>> stringAndOrTerms)
    • addStringExactSearch

      public void addStringExactSearch(String theSearchParamName, List<List<ca.uhn.fhir.model.api.IQueryParameterType>> theStringAndOrTerms)
    • addStringContainsSearch

      public void addStringContainsSearch(String theSearchParamName, List<List<ca.uhn.fhir.model.api.IQueryParameterType>> theStringAndOrTerms)
    • addStringUnmodifiedSearch

      public void addStringUnmodifiedSearch(String theSearchParamName, List<List<ca.uhn.fhir.model.api.IQueryParameterType>> theStringAndOrTerms)
    • addReferenceUnchainedSearch

      public void addReferenceUnchainedSearch(String theSearchParamName, List<List<ca.uhn.fhir.model.api.IQueryParameterType>> theReferenceAndOrTerms)
    • addDateUnmodifiedSearch

      public void addDateUnmodifiedSearch(String theSearchParamName, List<List<ca.uhn.fhir.model.api.IQueryParameterType>> theDateAndOrTerms)
      Create date clause from date params. The date lower and upper bounds are taken into consideration when generating date query ranges

      Example 1 ('eq' prefix/empty): http://fhirserver/Observation?date=eq2020 would generate the following search clause

       
       {
        "bool": {
          "must": [{
            "range": {
              "sp.date.dt.lower-ord": { "gte": "20200101" }
            }
          }, {
            "range": {
              "sp.date.dt.upper-ord": { "lte": "20201231" }
            }
          }]
        }
       }
       
       

      Example 2 ('gt' prefix): http://fhirserver/Observation?date=gt2020-01-01T08:00:00.000

      No timezone in the query will be taken as localdatetime(for e.g MST/UTC-07:00 in this case) converted to UTC before comparison

       
       {
         "range":{
           "sp.date.dt.upper":{ "gt": "2020-01-01T15:00:00.000000000Z" }
         }
       }
       
       

      Example 3 between dates: http://fhirserver/Observation?date=ge2010-01-01invalid input: '&date'=le2020-01

       
       {
         "range":{
           "sp.date.dt.upper-ord":{ "gte":"20100101" }
         },
         "range":{
           "sp.date.dt.lower-ord":{ "lte":"20200101" }
         }
       }
       
       

      Example 4 not equal: http://fhirserver/Observation?date=ne2021

       
       {
          "bool": {
             "should": [{
                "range": {
                   "sp.date.dt.upper-ord": { "lt": "20210101" }
                }
             }, {
                "range": {
                   "sp.date.dt.lower-ord": { "gt": "20211231" }
                }
             }],
             "minimum_should_match": "1"
          }
       }
       
       
      Parameters:
      theSearchParamName - e.g code
      theDateAndOrTerms - The and/or list of DateParam values buildDateTermClause(subComponentPath, value);
    • addQuantityUnmodifiedSearch

      public void addQuantityUnmodifiedSearch(String theSearchParamName, List<List<ca.uhn.fhir.model.api.IQueryParameterType>> theQuantityAndOrTerms)
      Differences with DB search: _ is not all-normalized-or-all-not. Each parameter is applied on quantity or normalized quantity depending on UCUM fitness _ respects ranges for equal and approximate qualifiers Strategy: For each parameter, if it can be canonicalized, it is, and used against 'normalized-value-quantity' index otherwise it is applied as-is to 'value-quantity'
    • addUriUnmodifiedSearch

      public void addUriUnmodifiedSearch(String theParamName, List<List<ca.uhn.fhir.model.api.IQueryParameterType>> theUriUnmodifiedAndOrTerms)
    • addNumberUnmodifiedSearch

      public void addNumberUnmodifiedSearch(String theParamName, List<List<ca.uhn.fhir.model.api.IQueryParameterType>> theNumberUnmodifiedAndOrTerms)
    • addCompositeUnmodifiedSearch

      public void addCompositeUnmodifiedSearch(ca.uhn.fhir.context.RuntimeSearchParam theSearchParam, List<ca.uhn.fhir.context.RuntimeSearchParam> theSubSearchParams, List<List<ca.uhn.fhir.model.api.IQueryParameterType>> theCompositeAndOrTerms)