blaze icon indicating copy to clipboard operation
blaze copied to clipboard

Unable to use `:contains` modifier when searching for a text element

Open lamurian opened this issue 9 months ago • 5 comments

Hi, thank you so much for developing Blaze; I've been learning a lot about FHIR by tinkering around with Blaze. Recently, I found out that I cannot search for resources using :contains modifier in any text element. For instance, I have a Questionnaire resource containing the following fields:

{
  "resourceType": "Questionnaire",
  "name": "phq2",
  "title": "Patient Health Questionnaire - 2 Items",
  "status": "active",
  "code": [
    {
      "system": "http://loinc.org",
      "code": "55757-9",
      "display": "Patient Health Questionnaire 2 item (PHQ-2) [Reported]"
    }
  ],
  "description": "Pemeriksaan Patient Health Questionnaire-2 (PHQ-2) dirancang untuk menilai secara singkat tingkat keparahan gejala-gejala yang berhubungan dengan depresi. Instrumen ini mengevaluasi dua aspek utama: seberapa sering seseorang merasa sedih atau putus asa, serta kehilangan minat atau kesenangan dalam aktivitas yang biasanya mereka nikmati.",
  . . .
}

I tried the following request to my Blaze server:

GET [base]/fhir/Questionnaire?description:contains=depres

Since the search term depres is available in the description, I expect this request will return the Questionnaire above, but it didn't:

{
  "id": "DFODX5DMWLBPXTIT",
  "type": "searchset",
  "total": 0,
  "link": [
    {
      "relation": "self",
      "url": "https://dev-blaze.konsulin.care/fhir/Questionnaire?description%3A=depres&_elements=title%2Cdescription&_count=50"
    }
  ],
  "resourceType": "Bundle"
}

I tried using the same Questionnaire resource and the same request to the HAPI FHIR server, and it correctly returned the resource as expected. I looked around at currently open and resolved issues, but there hasn't been any mention of this problem. One issue mentioned about unable to use :contains modifier, but the discussion did not completely address this concern.

  • Blaze version: 0.30.2
  • FHIR version: 4.0.1

lamurian avatar Mar 23 '25 16:03 lamurian

That you for this detailed report. Not many modifiers are implemented right now. Blaze doesn't have the indices for contains. Going over all resources is also not really an option. I'll leave this issue open but I can't promise a timely solution here.

alexanderkiel avatar Mar 25 '25 19:03 alexanderkiel

@alexanderkiel Is there any other way to find partial text matches in Blaze? Any plans on implementing fulltext indices that could be useful here?

tholu avatar Oct 22 '25 18:10 tholu

@tholu Fulltext indices are not planned in the foreseeable future as part of our funded work at the university. However there are other possibilities. If you like to talk, it's best to reach out on LinkedIn: www.linkedin.com/in/alexander-kiel-a0ba01a1

alexanderkiel avatar Oct 22 '25 18:10 alexanderkiel

@alexanderkiel Would you accept a Pull Request that implements this?

tholu avatar Oct 22 '25 18:10 tholu

Yes I also would accept pull request. If you like to do that, we should talk first.

alexanderkiel avatar Oct 22 '25 18:10 alexanderkiel