Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Food search endpoint doesn't seem to be deterministic.

I posted this in the SDK development forum, but I think it probably is better placed here.

 

I'm trying to work out the best way to use the food search endpoint in the web API (https://dev.fitbit.com/build/reference/web-api/food-logging/#search-foods)

 

I've assumed that the query parameter is just a string containing the user's search text, but I'm finding it difficult to use this effectively.

 

An example is if I search for a brand which I've created for my private custom foods. Sometimes, this will return my private foods in the results, but sometimes it will not and there doesn't seem to be a reliable way to craft the query to include my custom foods in the results every time.

 

Does the search query parameter support anything like Lucene query syntax in order to more reliably filter the result set?

 

Alternatively, is there any way to sort, filter or paginate the results?

Best Answer
0 Votes
1 REPLY 1

Hi @jbell1329 

 

Based on what I read about Lucene sync, I don't think the Search Food endpoint supports it.  The query parameter should just contain a string for the item that you're looking for.  I'll need to verify how we search for the food item, but I think we just see if the characters in the query string exist in the brand and name elements, with the result most resembling your value at the top of the results.  

 

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes