Repository: openfoodfacts/openfoodfacts-python

Issue:
Problem with product search, something is certainly hardcoded
### What
The App always return the result for "eau mineral" (I guess it's for this because it's always starting with cristaline)
which is basically making the API useless

### Steps to reproduce the behavior:
import openfoodfacts
api = openfoodfacts.API(version="v2")
results = api.product.text_search("Tomate")

### Expected behavior
Return products data that are in link with Tomate and not "mineral water"

### Platform (Desktop, Mobile, Hunger Games)
 - OS: MACOS
 - Platform MacBook AIR


Discussion:
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=openfoodfacts_openfoodfacts-python&pullRequest=191)

[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=BUG)  
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=VULNERABILITY)  
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=SECURITY_HOTSPOT)  
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=CODE_SMELL)

[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=openfoodfacts_openfoodfacts-python&pullRequest=191) No Coverage information  
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=openfoodfacts_openfoodfacts-python&pullRequest=191&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=openfoodfacts_openfoodfacts-python&pullRequest=191&metric=new_duplicated_lines_density&view=list)


alexgarel: @Fedeton thanks !

note:
- we are following [conventional commit](https://www.conventionalcommits.org/en/v1.0.0-beta.2/#summary) (otherwise [check fail](https://github.com/openfoodfacts/openfoodfacts-python/actions/runs/7053022469/job/19199274951))
alexgarel: @Fedeton a quality check is failing, can you fix it ?
alexgarel: Still failing @Fedeton !
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=openfoodfacts_openfoodfacts-python&pullRequest=191)

[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=BUG)  
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=VULNERABILITY)  
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=SECURITY_HOTSPOT)  
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=CODE_SMELL)

[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=openfoodfacts_openfoodfacts-python&pullRequest=191) No Coverage information  
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=openfoodfacts_openfoodfacts-python&pullRequest=191&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=openfoodfacts_openfoodfacts-python&pullRequest=191&metric=new_duplicated_lines_density&view=list)


Fedeton: I have made another commit, should I do something else or should I just wait?
alexgarel: @Fedeton still failing :-/ (were you able to run tests them locally ?)

> openfoodfacts/api.py:90: error: Incompatible types in assignment (expression has type "str", target has type "int")  [assignment]
> Found 1 error in 1 file (checked 15 source files)
> Error: Process completed with exit code 1.
raphael0202: @Fedeton can you update your branch with latest commit in develop?
mypy was temporarily failing on some commits in develop, but it's now fixed.
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=openfoodfacts_openfoodfacts-python&pullRequest=191)

[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=BUG)  
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=VULNERABILITY)  
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=SECURITY_HOTSPOT)  
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=openfoodfacts_openfoodfacts-python&pullRequest=191&resolved=false&types=CODE_SMELL)

[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=openfoodfacts_openfoodfacts-python&pullRequest=191) No Coverage information  
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=openfoodfacts_openfoodfacts-python&pullRequest=191&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=openfoodfacts_openfoodfacts-python&pullRequest=191&metric=new_duplicated_lines_density&view=list)


alexgarel: @Fedeton I invited you to our python team so next time you can start your branch directly on the project :-)

Patch:
diff --git a/README.md b/README.md
index 0294826..181e6dc 100644
--- a/README.md
+++ b/README.md
@@ -112,4 +112,4 @@ Contributors:
 
     Copyright 2016-2022 Open Food Facts
 
-The Open Food Facts Python SDK is licensed under the [MIT License](https://github.com/openfoodfacts/openfoodfacts-python/blob/develop/LICENSE).
\ No newline at end of file
+The Open Food Facts Python SDK is licensed under the [MIT License](https://github.com/openfoodfacts/openfoodfacts-python/blob/develop/LICENSE).
diff --git a/docs/usage.md b/docs/usage.md
index 39dfaca..c268e00 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -41,7 +41,7 @@ api.product.get(code)
 *Perform text search*
 
 ```python
-results = api.product.text_search("mineral water")
+results = api.product.text_search("pizza")
 ```
 
 *Create a new product or update an existing one*
diff --git a/openfoodfacts/api.py b/openfoodfacts/api.py
index cfcac1a..01bb049 100644
--- a/openfoodfacts/api.py
+++ b/openfoodfacts/api.py
@@ -197,7 +197,7 @@ class ProductResource:
             params["sort_by"] = sort_by
 
         return send_get_request(
-            url=f"{self.base_url}/api/v2/search",
+            url=f"{self.base_url}/cgi/search.pl",
             api_config=self.api_config,
             params=params,
         )


Test patch:
diff --git a/tests/test_api.py b/tests/test_api.py
index 5bf4917..d0d7698 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -86,7 +86,7 @@ class TestProducts(unittest.TestCase):
         with requests_mock.mock() as mock:
             response_data = {"products": ["kinder bueno"], "count": 1}
             mock.get(
-                "https://world.openfoodfacts.org/api/v2/search?"
+                "https://world.openfoodfacts.org/cgi/search.pl?"
                 + "search_terms=kinder+bueno&json=1&page="
                 + "1&page_size=20",
                 text=json.dumps(response_data),
@@ -95,7 +95,7 @@ class TestProducts(unittest.TestCase):
             self.assertEqual(res["products"], ["kinder bueno"])
             response_data = {"products": ["banania", "banania big"], "count": 2}
             mock.get(
-                "https://world.openfoodfacts.org/api/v2/search?"
+                "https://world.openfoodfacts.org/cgi/search.pl?"
                 + "search_terms=banania&json=1&page="
                 + "2&page_size=10&sort_by=unique_scans",
                 text=json.dumps(response_data),