-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Introduce container ordinal column in the search parameter index tables and populate it #5832
base: mm-20240318-support-for-contained-true-search-parameter
Are you sure you want to change the base?
Changes from all commits
7742aa7
4a726dd
4d4d8b2
2f9693a
6175807
9ddd8bf
9e5db19
6ce3b17
70843cd
e39ee7f
1736dad
fcf0a85
bdea4b6
3a5ff47
620b46d
5d55594
eafa2ab
107de2c
65a4fcc
4d8427a
8b0441a
f7b5871
71361a5
079f497
88289dc
5eb3b9b
238a4b3
04e3305
05f4870
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,7 +121,7 @@ public void testMigrateFrom340() throws IOException, SQLException { | |
assertEquals("identifier", values.get(0).get("SP_NAME")); | ||
assertEquals("12345678", values.get(0).get("SP_VALUE")); | ||
assertTrue(values.get(0).keySet().contains("HASH_IDENTITY")); | ||
assertEquals(7001889285610424179L, values.get(0).get("HASH_IDENTITY")); | ||
assertEquals(792023395537367244L, values.get(0).get("HASH_IDENTITY")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. serious problem: we must never change the hashes of existing data. Why did this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the bit in the hash (boolean) to distinguish contained indexes. I guess I can always leave as is if the property to index them is false. I did think about it, the impact would be less it just requires more branching in the code. |
||
return null; | ||
}); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
import ca.uhn.fhir.jpa.model.dao.JpaPid; | ||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; | ||
import ca.uhn.fhir.jpa.model.entity.StorageSettings; | ||
import ca.uhn.fhir.jpa.model.search.hash.ResourceIndexHasher; | ||
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; | ||
import ca.uhn.fhir.jpa.searchparam.MatchUrlService; | ||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; | ||
|
@@ -115,6 +116,9 @@ public class TransactionProcessor extends BaseTransactionProcessor { | |
@Autowired | ||
private IRequestPartitionHelperSvc myRequestPartitionSvc; | ||
|
||
@Autowired | ||
private ResourceIndexHasher myResourceIndexHasher; | ||
|
||
public void setEntityManagerForUnitTest(EntityManager theEntityManager) { | ||
myEntityManager = theEntityManager; | ||
} | ||
|
@@ -502,17 +506,15 @@ private void buildHashPredicateFromTokenParam( | |
Set<Long> theSysAndValuePredicates, | ||
Set<Long> theValuePredicates) { | ||
if (isNotBlank(theTokenParam.getValue()) && isNotBlank(theTokenParam.getSystem())) { | ||
theMatchUrl.myHashSystemAndValue = ResourceIndexedSearchParamToken.calculateHashSystemAndValue( | ||
myPartitionSettings, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. problem: Breaking change. The partition settings used to be used to control hash calculation. |
||
theMatchUrl.myHashSystemAndValue = myResourceIndexHasher.hash( | ||
theRequestPartitionId, | ||
theMatchUrl.myResourceDefinition.getName(), | ||
theMatchUrl.myMatchUrlSearchMap.keySet().iterator().next(), | ||
theTokenParam.getSystem(), | ||
theTokenParam.getValue()); | ||
theSysAndValuePredicates.add(theMatchUrl.myHashSystemAndValue); | ||
} else if (isNotBlank(theTokenParam.getValue())) { | ||
theMatchUrl.myHashValue = ResourceIndexedSearchParamToken.calculateHashValue( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same. |
||
myPartitionSettings, | ||
theMatchUrl.myHashValue = myResourceIndexHasher.hash( | ||
theRequestPartitionId, | ||
theMatchUrl.myResourceDefinition.getName(), | ||
theMatchUrl.myMatchUrlSearchMap.keySet().iterator().next(), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Do we need a new EmbeddedResources intermediate class? Is there a reason we can't apply ordinals to the other cases?
problem: I can't find a test for the ordinal assignment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Embedded resources can also mean resource entries in a bundle. Basically any resource that's embedded into another resource. I guess there may even be other cases. I kept is separate.
I added this test here for now: https://github.com/hapifhir/hapi-fhir/pull/5832/files#diff-d9ea0db9e7f4eb2987dbfb2fa7376d67cac04733f6fca71caeaa363bf207b12aR119. I plan to add some more after I implement the query/search part of the functionality.