Can you explain the difference between searching on OpenFDA with the .exact
suffix, and without the suffix? I'm a little confused
1 Answer
We sure can. Fields that permit an .exact
suffix have been indexed in two forms in the openFDA database (which uses Elasticsearch). A field without the .exact
suffix has been tokenized to allow flexible partial searches. For example, consider the following query: https://api.fda.gov/drug/ndc.json?search=brand_name:Advil&limit=1000. This will return all NDC drugs that contain Advil
within their brand name, such as CHILDRENS ADVIL,ADVIL MIGRAINE, and so on.
Now try adding the suffix as follows: https://api.fda.gov/drug/ndc.json?search=brand_name.exact:Advil&limit=1000. You will see fewer results, and each result will have its brand_name
exactly that: Advil
. Exact value match is now required.
Hope this makes sense.