bounswe / bounswe2015group1

Mama!
2 stars 3 forks source link

Ingredient Autocomplete Call - Status 500 #110

Closed sleepnir closed 8 years ago

sleepnir commented 8 years ago

Ingredient autocomplete call returns status 500 sometimes.

kerata commented 8 years ago

https://developer.nutritionix.com/docs/v2/ "we recommend using API v2.0 for experimentation only"

v2.0 is on development as it was stated in documentation in their site.

I think we should not use this call, instead use wild card search in v1.1 which could be done by our current API call search. It already supports this call but bear in mind, this is an EXPENSIVE! call so caching is important, either by server or by client.

Example replacement would be:

Request: http://ec2-52-89-168-70.us-west-2.compute.amazonaws.com:8080/api/ingredient/search/tom* Response: { "total_hits": 8555, "max_score": 0.6109619, "hits": [ { "_index": "f762ef22-e660-434f-9071-a10ea6691c27", "_type": "item", "_id": "51c3bd6897c3e6d8d3b476c8", "_score": 0.6109619, "fields": { "item_id": "51c3bd6897c3e6d8d3b476c8", "item_name": "Vinaigrette, Smoked Tomato", "brand_name": "Tom's", "nf_serving_size_qty": 1, "nf_serving_size_unit": "serving" } }, ...... instead Request: http://ec2-52-89-168-70.us-west-2.compute.amazonaws.com:8080/api/ingredient/autocomplete/tom Response: [ { "id": 181, "text": "tomatoes" }, { "id": 124113, "text": "tomatillos" }, ....

PS: Most likely autocomplete is faster and easier but not stable at the moment