Jump to content

Search API V3: Difference between revisions

m
no edit summary
(Add more API context, future work items)
mNo edit summary
Line 40: Line 40:


=== Data ===
=== Data ===
The core datatype will be the ''Product''.
The core datatype will be the ''Product''. This data will be stored sparsely (ie, fields that are not set will not be stored in the index) to reduce space.


To enable API cases such as partial text search, a rich autocomplete, and the possibility of eventually serving as a unified read layer, [https://static.openfoodfacts.org/data/data-fields.txt all fields] will be added to the index. Only product names, brands and categories will be indexed for autocomplete queries.
To enable API cases such as partial text search, a rich autocomplete, and the possibility of eventually serving as a unified read layer, [https://static.openfoodfacts.org/data/data-fields.txt all fields] will be added to the index. Only product names, brands and categories will be indexed for autocomplete queries.
Line 145: Line 145:
* ''gt'', ''lt'' (greater than, less than) operators are provided.
* ''gt'', ''lt'' (greater than, less than) operators are provided.
* To maintain backwards compatibility, a ''without'' operator is provided, in which case the value will be ignored. Note that the value is still required, so a dummy value should be used (it was feared that making this optional would lead to client side bugs). This should be well documented.
* To maintain backwards compatibility, a ''without'' operator is provided, in which case the value will be ignored. Note that the value is still required, so a dummy value should be used (it was feared that making this optional would lead to client side bugs). This should be well documented.
* The without operator will match empty data, as well as the empty string and 0 for numeric fields. This supports queries such as "Get foods without carbohydrates" for backwards comptability, even though that would be better served by making a query where carbohydrates = 0 (ensuring that missing data is not returned in the results).
* There is no support for an OR operator (which is supported in the [[Open Food Facts Search API Version 2|V2 API]]), however clients can perform this logic themselves if they wish through multiple API calls.
* There is no support for an OR operator (which is supported in the [[Open Food Facts Search API Version 2|V2 API]]), however clients can perform this logic themselves if they wish through multiple API calls.


17

edits