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

Updating String search parameters for resource fails if normalized String starts with same letter #4147

Closed
lukedegruchy opened this issue Oct 17, 2022 · 0 comments · Fixed by #4148

Comments

@lukedegruchy
Copy link
Collaborator

NOTE: Before filing a ticket, please see the following URL:
https://github.com/hapifhir/hapi-fhir/wiki/Getting-Help

Describe the bug
When updating a search parameter, if the Resources's normalized String (ex: last name) starts with the same letter under the new algorithm as the old, the update will not happen and searches will only work under the old normalized String. If the first letter is different, searching works as expected.

To Reproduce
Steps to reproduce the behavior:

  1. Create a phonetic search parameter "query-1-param" for Patient resource using the search algorithm "DOUBLE_METAPHONE" with expression "expression": "name.family | name.given.first() | telecom.where(system='email').value.first()"
  2. Create a patient with a first name and last name of "John Doe"
  3. Update/PUT that index to a new algorithm: "NYSIIS_LONG"
  4. Create another patient with a first name and last name of "John Doe"
  5. Trigger a reindex on all resources or all patient resources
  6. Search on query-1-param of "JAN" (the new normalized String.

Expected behavior
Searching on JAN should return both patients. In this case, it only returns the first patient.

Screenshots
N/A

Environment (please complete the following information):

  • Latest hapi-fhir in master

Additional context
The normalized Strings in table/column hfj_spidx_string.sp_value_normalized are the following:

old algorithm:

first: JN
last. T

new algorithm:

first: JAN
last: D

Because of the equals/hashCode implementation and the normalized hash String, which takes into account only the single letter, the search parameter update from "JN" to "JAN" will not be recognized as a difference, and the database row will remain as "JN" for the second patient after reindexing, whereas it should have been updated to "JAN"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant