6,323
edits
mNo edit summary |
No edit summary |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
This document serves as a technical proposal for a new search API - V3 ([[Open Food Facts Search API Version 2|see V2 here]]). | This document serves as a technical proposal for a new search API - V3 ([[Open Food Facts Search API Version 2|see V2 here]]). | ||
'''NOTE''': '''We're now extracting search to [[Search-a-licious]], which has an OpenAPI documentation, an Elastic-Search backend and everything you'd expect from a modern search API.''' | |||
'''IMPORTANT:''' our goal have shifted a bit on this project. See [https://docs.google.com/document/d/1mibE8nACcmen6paSrqT9JQk5VbuvlFUXI1S93yHCK2I/edit Search-a-licious roadmap architecture notes] | |||
=== Goals === | === Goals === | ||
Line 92: | Line 95: | ||
field: str | field: str | ||
value: str | value: str | ||
# One of eq, ne, like | # One of eq, ne, like | ||
operator: str = 'eq' | operator: str = 'eq' | ||
Line 99: | Line 102: | ||
field: str | field: str | ||
value: float | value: float | ||
# One of eq, ne, lt, gt | # One of eq, ne, lt, gt | ||
operator: str = 'eq' | operator: str = 'eq' | ||
Line 106: | Line 109: | ||
field: str | field: str | ||
value: datetime.datetime | value: datetime.datetime | ||
# One of | # One of lt, gt | ||
operator: str = 'eq' | operator: str = 'eq' | ||
Line 136: | Line 139: | ||
The remaining APIs have several commonalities: | The remaining APIs have several commonalities: | ||
* An optional ''response_fields'' parameter is provided, to limit the fields in the response further | * An optional ''response_fields'' parameter is provided, to limit the fields in the response further | ||
* POST is used, to support a complex request body | * POST is used, to support a complex request body | ||
Line 144: | Line 146: | ||
* ''like'' operator, which does not need to match to exact fields, but rather will match by use of the [https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-snowball-tokenfilter.html snowball token filter] in Elasticsearch if the field supports it. | * ''like'' operator, which does not need to match to exact fields, but rather will match by use of the [https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-snowball-tokenfilter.html snowball token filter] in Elasticsearch if the field supports it. | ||
* ''gt'', ''lt'' (greater than, less than) operators are provided. | * ''gt'', ''lt'' (greater than, less than) operators are provided. | ||
* 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. | ||
Line 157: | Line 157: | ||
== Work Plan == | == Work Plan == | ||
* Completed | * Completed | ||
** Product document definition | ** Product document definition | ||
** Bulk import script | ** Bulk import script | ||
** API definition | ** API definition | ||
** API implementation | ** API implementation | ||
** Docker, Elasticvue configuration | ** Docker, Elasticvue configuration | ||
** API tests | |||
** Redis Integration | |||
* TODO: | * TODO: | ||
** Deploy (without any traffic) | |||
** Deploy (without any traffic) | |||
** Redis writer on the Perl side | ** Redis writer on the Perl side | ||
** Final testing | ** Final testing | ||
Line 181: | Line 179: | ||
* Robotoff could use the same cluster | * Robotoff could use the same cluster | ||
* Current search APIs could be switched over (with a translation layer) | * Current search APIs could be switched over (with a translation layer) | ||
[[Category:Search]] |