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.
-
-
-
+:::tip
+The `value` key in the preset configuration can also match the search parameters for Federated / Multi Search. For example:
-```dart
- await client.presets.upsert('listing_view', {
- 'value': {
- {
- 'collection': 'products',
- 'q': '*',
- 'sort_by': 'popularity',
- }
- }
- });
+```js
+ await client.presets().upsert("listing_view", {
+ value: {
+ searches: [
+ {
+ collection: "products",
+ q: "*",
+ sort_by: "popularity",
+ },
+ {
+ collection: "blog_posts",
+ q: "*",
+ sort_by: "published_at:desc",
+ }
+ ],
+ },
+ })
```
+:::
-
-
-
-```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": {"collection":"products","q":"*", "sort_by": "popularity"}}'
-```
-
-
+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.
-
-
-
-
-```dart
- await client.presets.upsert('listing_view', {
- 'value': {
- {
- 'collection': 'products',
- 'q': '*',
- 'sort_by': 'popularity',
- }
- }
- });
-```
-
-
-
-
-```go
-preset := &api.PresetUpsertSchema{}
-preset.Value.FromSearchParameters(api.SearchParameters{
- Q: pointer.String("*"),
- SortBy: pointer.String("popularity"),
-})
+:::tip
+The `value` key in the preset configuration can also match the search parameters for Federated / Multi Search. For example:
-client.Presets().Upsert(context.Background(), "listing-view", preset)
+```js
+ await client.presets().upsert("listing_view", {
+ value: {
+ searches: [
+ {
+ collection: "products",
+ q: "*",
+ sort_by: "popularity",
+ },
+ {
+ collection: "blog_posts",
+ q: "*",
+ sort_by: "published_at:desc",
+ }
+ ],
+ },
+ })
```
+:::
-
-
-
-```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": {"collection":"products","q":"*", "sort_by": "popularity"}}'
-```
-
-
+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.
+
+
```js
-await client.multiSearch().perform({},{
- preset: 'listing_view'
-});
+let searchRequests = {
+ 'searches': [
+ {
+ 'preset': 'listing_view'
+ }
+ ]
+}
+
+client.multiSearch.perform(searchRequests, {})
```
-
-```dart
-await client.multiSearch.perform({}, queryParams: {
- 'preset': 'listing_view'
-});
-```
+
-
-
+```php
+$searchRequests = [
+ 'searches' => [
+ [
+ 'preset' => 'listing_view'
+ ]
+ ]
+];
-```go
-client.MultiSearch.Perform(context.Background(),
- &api.MultiSearchParams{
- Preset: pointer.String("listing_view"),
- },
- api.MultiSearchSearchesParameter{},
-)
+$client->multiSearch->perform($searchRequests, []);
```
-
+
-```shell
-curl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -X POST \
-'http://localhost:8108/multi_search?preset=listing_view'
+```py
+search_requests = {
+ 'searches': [
+ {
+ 'preset': 'listing_view'
+ }
+ ]
+}
+
+client.multi_search.perform(search_requests, {})
```
+
-
+
-You can use the preset configuration for a `GET .../search` end-point as well.
+```rb
+search_requests = {
+ 'searches': [
+ {
+ 'preset': 'listing_view'
+ }
+ ]
+}
-The only requirement is that for
-`GET .../search`, the stored preset value should be a simple dictionary of search configurations, like this.
+client.multi_search.perform(search_requests, {})
+```
-
+
```dart
- await client.presets.upsert('listing_view', {
- 'value': {
- {
- 'collection': 'products',
- 'q': '*',
- 'sort_by': 'popularity',
- }
+final searchRequests = {
+ 'searches': [
+ {
+ 'preset': 'listing_view'
}
- });
+ ]
+};
+
+await client.multiSearch.perform(searchRequests, queryParams: {});
+```
+
+
+
+
+```java
+HashMap search1 = new HashMap<>();
+
+search1.put("preset","listing_view");
+
+List> searches = new ArrayList<>();
+searches.add(search1);
+
+HashMap>> searchRequests = new HashMap<>();
+searchRequests.put("searches",searches);
+
+HashMap commonSearchParams = new HashMap<>();
+
+client.multiSearch.perform(searchRequests, commonSearchParams);
```
```go
-preset := &api.PresetUpsertSchema{}
-preset.Value.FromSearchParameters(api.SearchParameters{
- Q: pointer.String("*"),
- SortBy: pointer.String("popularity"),
-})
+searchRequests := api.MultiSearchSearchesParameter{
+ Searches: []api.MultiSearchCollectionParameters{
+ {
+ Preset: "listing_view"
+ },
+ },
+}
-client.Presets().Upsert(context.Background(), "listing-view", preset)
+commonSearchParams := &api.MultiSearchParams{}
+
+client.MultiSearch.Perform(context.Background(), commonSearchParams, searchRequests)
```
-```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": {"collection":"products","q":"*", "sort_by": "popularity"}}'
+```bash
+curl "http://localhost:8108/multi_search" \
+ -X POST \
+ -H "Content-Type: application/json" \
+ -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
+ -d '{
+ "searches": [
+ {
+ "preset": "listing_view"
+ }
+ ]
+ }'
```
+
:::tip
-Explicit query parameters passed to the search end-point will override parameters stored in preset value.
+The `value` key in the preset configuration can also match the search parameters for Federated / Multi Search. For example:
+
+```js
+ await client.presets().upsert("listing_view", {
+ value: {
+ searches: [
+ {
+ collection: "products",
+ q: "*",
+ sort_by: "popularity",
+ },
+ {
+ collection: "blog_posts",
+ q: "*",
+ sort_by: "published_at:desc",
+ }
+ ],
+ },
+ })
+```
:::
+
+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