Skip to content

Commit

Permalink
docs: warning about search API v2 not supporting full text search (#9823
Browse files Browse the repository at this point in the history
)

docs: warning about search API v2 not supporting full text search, as this is a common pitfall
  • Loading branch information
alexgarel committed Mar 6, 2024
1 parent 8594c2e commit a9dc38b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 7 additions & 1 deletion docs/api/ref-cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ add_brands

## Search for Products

[Reference documentation for search API](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v2/#get-/api/v2/search)
**Important:** full text search currently works only for v1 API (or search-a-licious, which is in beta)

[documentation for v1 Search API](https://wiki.openfoodfacts.org/API/Read/Search)

[Reference documentation for v2 search API](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v2/#get-/api/v2/search)

The future of search is the [search-a-licious project](https://github.com/openfoodfacts/search-a-licious), deployed, in beta, at [search.openfoodfacts.org](https://search.openfoodfacts.org/).

### Get data for a list of products

Expand Down
9 changes: 8 additions & 1 deletion docs/api/ref/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,17 @@ paths:
$ref: ./responses/search_for_products.yaml
operationId: get-search
description: |
Search request allows you to get the nutritional data of products that match your search criteria.
Search request allows you to get products that match your search criteria.
It allows you create many custom APIs for your use case.
If the search query parameter has 2 possible values, they are seperated by a comma(,).
When filtering via a parameter that has different language codes like `fr`, `de` or `en`, specify the language code in the parameter name e.g `categories_tags_en`
**Important:** search API v2 does not support full text request (search_term),
you have to use [search API v1](https://wiki.openfoodfacts.org/API/Read/Search) for that.
Upcoming [search-a-licious project](https://github.com/openfoodfacts/search-a-licious) will fix that.
parameters:
# all tags parameters
- $ref: './schemas/tags_parameters.yaml#/properties/additives_tags'
Expand Down
2 changes: 2 additions & 0 deletions docs/api/tutorial-off-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ You can also check the reference cheatsheet to know how to add/edit other types

Using the Open Food Facts API, you can filter products based on different criteria. To search for products in the Orange Juice category with a nutrition_grade of `c`, query the [Search for Products endpoint](https://openfoodfacts.github.io/openfoodfacts-server/api/ref-v2/#get-/api/v2/search).

**Note:** we describe here the v2 search API, but beware that only [v1 search API](https://wiki.openfoodfacts.org/API/Read/Search) supports full text search.

### Describing the Search Request

Make a `GET` request to the `Search for Products` endpoint.
Expand Down

0 comments on commit a9dc38b

Please sign in to comment.