Intro: I am new to the OpenMRS project and need some help regarding the creation of a Lucene query in the core. I hope someone can point me to a helpful link, example or explain to me the best approach. Thank you!
Issue: I am currently working on a ticket that aims to fix a bug in the PatientService implementation (TRUNK-5395). My approach to fix this issue is to adapt a LuceneQuery to return only the PatientIdentifier objects where a specific constraint is matched. The call looks like the following:
The PatientIdentifier class itself has an attribute called identifierType of the type PatientIdentifierType GitHub Link. This attribute is referenced inside the LuceneQuery I am creating.
However, I am interested in the value of an attribute of this particular object, which is called patientIdentifierTypeId. (api/src/main/java/org/openmrs/PatientIdentifierType.java#L60) --> hence identifierType.patientIdentifierTypeId
In the end, I am trying to restrict the returned objects to only the once which have as attribute an identifierType, that has as patientIdentifierTypeId a certain Integer value. However, this restriction does not seem to work and I a seem to struggle to find a way to define a constraint that restricts the value of an attribute that is itself an object.
Does someone has an idea how I can define such a constraint?