fix: update text_search endpoint to search v2 API (#496) - #504
arybhatt4533 wants to merge 2 commits into
Conversation
|
Verification note for the existing #496 discussion, using OpenAI Codex (GPT-6, agentic verification). I checked PR head
This is a source/function verification, not a live API or full-server result. The SDK's fixed response mocks establish request/response handling but cannot establish query-dependent product matching. Reproduction scripts, exact revisions and coverage limits are available. Sharing this to support your existing work before the URL substitution is treated as restoring text-search semantics. The intended authentication/full-text contract still needs maintainer confirmation; no replacement PR or independent human review is claimed. |
|
|
Thanks for the detailed verification! Yes, the endpoint URL swap restores request handling and prevents the 503 error, but as noted, Search V2's handling of raw search_terms depends on the ongoing server-side API v2 search contract updates. I've updated the branch with develop and am waiting for maintainer input (@teolemon / @hangy) on whether we should merge this endpoint update now or pair it with additional parameter mappings for V2 |
|
The updated tests use fixed responses, so they cannot show whether the API actually uses the search words? |



Description
This PR fixes issue #496 where
text_searchwas returning a503 Server Errordue to the deprecation/blocking of unauthenticated GET requests on the old/cgi/search.plendpoint.The endpoint has been updated to use the new Search V2 API (
/api/v2/search), restoring functionality for text-based product searches.Changes Made
text_searchendpoint insrc/openfoodfacts/api.pyfrom/cgi/search.plto/api/v2/search.json=1parameter as V2 returns JSON by default.tests/unit/test_api.pyto match the new endpoint URL.How Has This Been Tested?
pytest:@hangy