_ilike
ilike search by resource content
With _ilike search parameter you search for terms inclusion as substring in text representation of FHIR resource. Interesting feature of this parameter, that it can provide quick feedback to user about matches without forcing she to print the whole word (as with full text search). For example jo will find Johns and Jolie or asp will match Aspirin.
That's why it is default search in Aidbox Console user interface.
1
GET /Patient?_ilike=joh+smit,jes+park
Copied!
With _ilike parameter you terms separeted with space combined withAND and separeted by comma , withOR . Example abowe is translated into SQL query like this:
1
SELECT * FROM patient
2
WHERE
3
resource::text ilike '%joh%' AND ... ilike '%smit%'
4
OR
5
resource::text ilike '%jes%' AND ... '%park%'
Copied!
ILIKE search can be efficiently indexed with trigram PostgreSQL extension and GIN Index, providing response in tens of miliseconds responses on milions of records.
1
CREATE INDEX patient_trgm_idx on patient
2
USING gin (
3
(id || ' ' || resource::text) gin_trgm_ops
4
);
5
6
VACUUM ANALYZE patient;
Copied!
Last modified 2yr ago
Copy link