diff --git a/docs-site/content/27.0/api/search.md b/docs-site/content/27.0/api/search.md index 69b51766..03bb6ec2 100644 --- a/docs-site/content/27.0/api/search.md +++ b/docs-site/content/27.0/api/search.md @@ -716,7 +716,7 @@ Let's create a preset with name `listing_view`. ```js await client.presets().upsert("listing_view", { value: { - searches: [{ collection: "products", q: "*", sort_by: "popularity" }], + collection: "products", q: "*", sort_by: "popularity", }, }); ``` @@ -727,9 +727,7 @@ Let's create a preset with name `listing_view`. ```dart await client.presets.upsert('listing_view', { 'value': { - 'searches': [ - {'collection': 'products', 'q': '*','sort_by': 'popularity'} - ] + 'collection': 'products', 'q': '*','sort_by': 'popularity' } }); ``` @@ -741,11 +739,10 @@ Let's create a preset with name `listing_view`. curl "http://localhost:8108/presets/listing_view" -X PUT \ -H "Content-Type: application/json" \ -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \ --d '{"value": {"searches":[{"collection":"products","q":"*", "sort_by": "popularity"}]}}' +-d '{"value": {"collection":"products","q":"*", "sort_by": "popularity"}}' ``` - You can refer to this preset configuration during a search operation. @@ -776,37 +773,30 @@ curl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -X POST \ -You can use the preset configuration for a `GET .../search` end-point as well. - -The only requirement is that for -`GET .../search`, the stored preset value should be a simple dictionary of search configurations, like this. - - - - - +It's generally recommended to use single-search presets for flexibility. You can then combine them in a multi-search request using the `preset` parameter. :::tip Explicit query parameters passed to the search end-point will override parameters stored in preset value. diff --git a/docs-site/content/27.1/api/search.md b/docs-site/content/27.1/api/search.md index 98d10cbd..3b6c42f9 100644 --- a/docs-site/content/27.1/api/search.md +++ b/docs-site/content/27.1/api/search.md @@ -756,7 +756,7 @@ Let's create a preset with name `listing_view`. ```js await client.presets().upsert("listing_view", { value: { - searches: [{ collection: "products", q: "*", sort_by: "popularity" }], + collection: "products", q: "*", sort_by: "popularity", }, }); ``` @@ -767,9 +767,7 @@ Let's create a preset with name `listing_view`. ```dart await client.presets.upsert('listing_view', { 'value': { - 'searches': [ - {'collection': 'products', 'q': '*','sort_by': 'popularity'} - ] + 'collection': 'products', 'q': '*','sort_by': 'popularity' } }); ``` @@ -799,7 +797,7 @@ client.Presets().Upsert(context.Background(), "listing-view", preset) curl "http://localhost:8108/presets/listing_view" -X PUT \ -H "Content-Type: application/json" \ -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \ --d '{"value": {"searches":[{"collection":"products","q":"*", "sort_by": "popularity"}]}}' +-d '{"value": {"collection":"products","q":"*", "sort_by": "popularity"}}' ``` @@ -846,51 +844,31 @@ curl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -X POST \ -You can use the preset configuration for a `GET .../search` end-point as well. - -The only requirement is that for -`GET .../search`, the stored preset value should be a simple dictionary of search configurations, like this. - - - - - - +It's generally recommended to use single-search presets for flexibility. You can then combine them in a multi-search request using the `preset` parameter. :::tip Explicit query parameters passed to the search end-point will override parameters stored in preset value. -::: +::: \ No newline at end of file diff --git a/docs-site/content/28.0/api/search.md b/docs-site/content/28.0/api/search.md index 72dc1835..5a997fed 100644 --- a/docs-site/content/28.0/api/search.md +++ b/docs-site/content/28.0/api/search.md @@ -965,7 +965,7 @@ Let's create a preset with name `listing_view`. ```js await client.presets().upsert("listing_view", { value: { - searches: [{ collection: "products", q: "*", sort_by: "popularity" }], + collection: "products", q: "*", sort_by: "popularity", }, }); ``` @@ -976,9 +976,7 @@ Let's create a preset with name `listing_view`. ```dart await client.presets.upsert('listing_view', { 'value': { - 'searches': [ - {'collection': 'products', 'q': '*','sort_by': 'popularity'} - ] + 'collection': 'products', 'q': '*','sort_by': 'popularity' } }); ``` @@ -1006,100 +1004,180 @@ client.Presets().Upsert(context.Background(), "listing-view", preset) ```shell curl "http://localhost:8108/presets/listing_view" -X PUT \ --H "Content-Type: application/json" \ --H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \ --d '{"value": {"searches":[{"collection":"products","q":"*", "sort_by": "popularity"}]}}' + -H "Content-Type: application/json" \ + -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \ + -d '{ + "value": { + "collection": "products", + "q": "*", + "sort_by": "popularity" + } + }' ``` -You can refer to this preset configuration during a search operation. +You can refer to this preset configuration during a search operation using the `preset` search parameter. - +The following shows the [`multi_search`](./federated-multi-search.md) endpoint, but you can also use the `preset` search parameter with the single search endpoint as well. + + -