0

I am using below API query to fetch recalls for food by city AND termination date range.

but it doesn't seem to work

https://api.fda.gov/food/enforcement.json?search=city:%22Westminster%22+AND+termination_date:[2011-01-01+TO+2014-01-01]&limit=3&skip=100

but if I update the query with just (+ : it acts as OR condition) : https://api.fda.gov/food/enforcement.json?search=city:%22Westminster%22+termination_date:[2011-01-01+TO+2014-01-01]&limit=3&skip=100

then i get the results.

Seems that the '+AND+' function doesn't respond properly, as there is data already present with the filter I am using with +AND+ query.

Please help.

  • 2
    I removed &limit=3&skip=100 from your first query and it returned results... does that mean there are fewer than 100 results? – philshem Apr 24 at 13:51
  • It would help if you clarified what you expected to see in the results. Once following @philshem 's pointer and removing the limit, the results are exactly as I'd expect. (That said, it's unfortunate that the "skip" syntax is handled differently when AND is in the query.) – Joe Germuska May 6 at 20:34
2

There is only one record in this dataset that matches the criteria you provided, and since you are using the skip parameter with a value of 100, the record essentially gets excluded from the result set. Try dropping the skip parameter: https://api.fda.gov/food/enforcement.json?search=city:"Westminster"+AND+termination_date:[2011-01-01+TO+2014-01-01]&limit=3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.