:contains on string search parameters


#1

Hi there,

Reading the search spec, there seems to be conflicts?

http://hl7.org/fhir/search.html#modifiers

For string: :exact (the match needs to be exact, no partial matches, case sensitive and accent-sensitive), or :contains (case insensitive and accent-insensitive, partial match at start or end), instead of the default behavior (case insensitive and accent-insensitive, partial matches at the end of the string).

http://hl7.org/fhir/search.html#string

For a simple string search, a string parameter serves as the input for a case- and accent-insensitive search against sequences of characters. By default, a field matches a string query if the value of the field equals or starts with the supplied parameter value, after both have been normalized by case and accent. The :contains modifier returns results that include the supplied parameter value anywhere within the field being searched.

Under modifiers section, it says :contains should be partial match at start or end but string section says anywhere within the field.

Also, under modifier section, it says the default behavior should be partial matches at the end of the string but in string section, it says the default behavior is equals or starts with the supplied value.

Which rule should we follow?

Thanks!


#2

Default is partial matches at start of string, not end. That’s a typo. I just created https://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&tracker_item_id=14390

:contains… not sure. I take it as anywhere in the string in my server. Further discussion, see https://chat.fhir.org/#narrow/stream/implementers/subject/.3Acontains.20modifier


#3

Thanks Grahame.

:contain should match value that appears anywhere in the text so I think the description under modifier section needs to be fixed.