Jump to content

Search API V3: Difference between revisions

Add more API context, future work items
mNo edit summary
(Add more API context, future work items)
Line 132: Line 132:
   
   
=== API Discussion ===
=== API Discussion ===
The barcode GET API is included to demonstrate how this service could easily replace our existing APIs, but is not intended to be used for the moment.  
The barcode GET API is included to demonstrate how this service could easily replace our existing read APIs, but is not intended to be used for the moment.  


The remaining APIs have several commonalities:
The remaining APIs have several commonalities:
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.
* 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.
=== Relationship With Existing APIs ===
The autocomplete API does not overlap with the other APIs. However, the new proposed ''/search'' API has a lot of conceptual overlap with the current search APIs. It is proposed to encourage users to migrate to this new V3 API (and to use it when writing new code) through guidance in the API docs.
Furthermore, once the new API has proven its stability, the legacy ''search.pl'' should be able to be switched over (with a translation layer to map between old and new API request and response norms). The v2 API can also be migrated, but will require a solution to supporting the OR operator (potentially dropping support, using another translation layer with multiple requests, or modifying the API).
This work is considered out of scope for this proposal.


== Work Plan ==
== Work Plan ==
Line 164: Line 172:
** Document API
** Document API
** Ongoing monitoring
** Ongoing monitoring
== Future Work ==
There appears to be a lot of opportunities to utilize this infrastructure further:
* Incorporate the autocomplete API in to the main search bar
* Use the new search API to handle searches on the primary website (should result in improved ranking, matching, lower DB load)
* Robotoff could use the same cluster
* Current search APIs could be switched over (with a translation layer)
17

edits