diff --git a/packages/docs/src/content/docs/cloud/answer-engine/creating-an-answer-session.mdx b/packages/docs/src/content/docs/cloud/answer-engine/creating-an-answer-session.mdx
index 7d0cfa8ee..a16edbcef 100644
--- a/packages/docs/src/content/docs/cloud/answer-engine/creating-an-answer-session.mdx
+++ b/packages/docs/src/content/docs/cloud/answer-engine/creating-an-answer-session.mdx
@@ -938,7 +938,6 @@ The main difference between `userContext` and `userData` is that the `userData`
Of course, Orama will remember the `userData` in subsequent answer requests, but will tend to forget it after a while. So, if that data is important to you, you should either provide it in every answer request, or use the `userContext` instead.
-
## Aborting Answers Generation
In any moment in time (when a user cancels an answer request, for example) you can abort an answer by using the `.abortAnswer` function:
@@ -1007,7 +1006,63 @@ This will trigger the `onAnswerAborted` event, which will simply return a `true`
-## Getting all the Messages
+## Getting related queries
+
+When creating answer sessions, you may want to provide your users with a list of related queries that they can use to get more information about a specific topic. You can do this by using the `related` parameter:
+
+When asking for `"question"` (default) related queries, Orama will return an array of related queries in a question format. For example, if the user asks for: "What is Orama?", Orama will return an array of related queries like: `["How does Orama work?", "Why is Orama the best?", "How do I run vector search?"]`.
+
+If the format is `"query"`, Orama will return an array of related queries in a query format. For example, if the user asks for: "What is Orama?", Orama will return an array of related queries like: `["How Orama works", "Why Orama is the best", "Vector search with Orama"]`.
+
+
+
+ ```javascript copy
+ const answerSession = orama.createAnswerSession({
+ events: {
+ onRelatedQueries: (relatedQueries) => {
+ console.log(relatedQueries);
+ // ["How Orama works", "Why Orama is the best", "Vector search with Orama"]
+ },
+ }
+ });
+
+ await answerSession.ask({
+ term: "What is Orama?",
+ related: {
+ howMany: 3, // How many related queries you want to get. Maximum is 5.
+ format: 'query'
+ }
+ });
+ ```
+
+
+ ```swift copy
+ ```swift copy
+ let answer = try await answerSession.ask(params: AnswerParams.AskParams(
+ query: "What is Orama?",
+ userData: "The user is a beginner in programming",
+ related: AnswerParams.RelatedQueries(howMany: 3, format: "query")
+ ))
+ ```
+
+
+ ```kotlin copy
+ print("coming soon")
+ ```
+
+
+ ```python copy
+ print("coming soon")
+ ```
+
+
+ ```php copy
+ // coming soon
+ ```
+
+
+
+## Getting all the messages
At any point in time, you can retrieve all the messages by calling the `.getMessages` function:
@@ -1089,7 +1144,7 @@ Sometimes, the user may want to regenerate the last answer. You can do this by c
// Regenerate the answer
// "stream" is true by default, but you can set it to false if you want to get the entire answer at once
- let answer = try await answerSession.regenerateLast(params: AnswerParams.RegenerateParams(stream: false))
+ let answer = try await answerSession.regenerateLast(stream: false)
// Check the messages
let messages = answerSession.getMessages()
diff --git a/packages/docs/src/content/docs/cloud/performing-search/full-text-search.mdx b/packages/docs/src/content/docs/cloud/performing-search/full-text-search.mdx
index cc4a04622..bc6302f77 100644
--- a/packages/docs/src/content/docs/cloud/performing-search/full-text-search.mdx
+++ b/packages/docs/src/content/docs/cloud/performing-search/full-text-search.mdx
@@ -46,7 +46,7 @@ The client exposes a simple `search` method that can be used to query the index:
```swift copy
- import OramaCloud
+ import OramaCloudClient
struct MyDoc: Codable {
let title: String
@@ -267,42 +267,18 @@ With the Orama Faceted Search API, users can filter their search results by vari
Given the following Orama schema:
-
-
- ```json
- {
- title: "string",
- description: "string",
- categories: {
- primary: "string",
- secondary: "string",
- },
- rating: "number",
- isFavorite: "boolean",
- }
- ```
-
-
- ```swift copy
- print("coming soon")
- ```
-
-
- ```kotlin copy
- print("coming soon")
- ```
-
-
- ```python copy
- print("coming soon")
- ```
-
-
- ```php copy
- // coming soon
- ```
-
-
+```json title=schema.json
+{
+ "title": "string",
+ "description": "string",
+ "categories": {
+ "primary": "string",
+ "secondary": "string",
+ },
+ "rating": "number",
+ "isFavorite": "boolean",
+}
+```
Orama will be able to generate facets at search-time based on the schema. To do so, we need to specify the `facets` property in the `search` configuration:
@@ -311,6 +287,7 @@ Orama will be able to generate facets at search-time based on the schema. To do
```js
const results = await client.search({
term: "Movie about cars and racing",
+ mode: "hybrid",
properties: ["description"],
facets: {
"categories.primary": {
@@ -338,7 +315,34 @@ Orama will be able to generate facets at search-time based on the schema. To do
```swift copy
- print("coming soon")
+ import OramaCloudClient
+
+ struct MyDoc: Codable {
+ let title: String
+ let description: String
+ }
+
+ let clientParams = OramaClientParams(endpoint: "", apiKey: "")
+ let client = OramaClient(params: clientParams)
+
+ let searchParams = ClientSearchParams.builder(
+ term: "Movie about cars and racing",
+ mode: .hybrid
+ )
+ .properties(["description"]) // optional
+ .facets([
+ "category.primary": .string(limit: 3, order: .desc),
+ "category.secondary": .string(limit: 2, order: .desc),
+ "rating": .number(ranges: [
+ ClientSearchParams.Facet.NumberRange(from: 0, to: 3),
+ ClientSearchParams.Facet.NumberRange(from: 3, to: 7),
+ ClientSearchParams.Facet.NumberRange(from: 7, to: 10),
+ ]),
+ "isFavorite": .boolean(isTrue: true, isFalse: true),
+ ])
+ .build()
+
+ let searchResults: SearchResults = try await client.search(query: searchParams)
```
diff --git a/packages/docs/src/content/docs/cloud/performing-search/hybrid-search.mdx b/packages/docs/src/content/docs/cloud/performing-search/hybrid-search.mdx
index cc77f2152..242ccd299 100644
--- a/packages/docs/src/content/docs/cloud/performing-search/hybrid-search.mdx
+++ b/packages/docs/src/content/docs/cloud/performing-search/hybrid-search.mdx
@@ -52,7 +52,7 @@ Once you have at least one index containing vectors, you can perform hybrid sear
```swift copy
- import OramaCloud
+ import OramaCloudClient
struct MyDoc: Encodable & Decodable {
let title: String
diff --git a/packages/docs/src/content/docs/cloud/performing-search/vector-search.mdx b/packages/docs/src/content/docs/cloud/performing-search/vector-search.mdx
index 1cc25302f..a4f986c58 100644
--- a/packages/docs/src/content/docs/cloud/performing-search/vector-search.mdx
+++ b/packages/docs/src/content/docs/cloud/performing-search/vector-search.mdx
@@ -48,7 +48,7 @@ Once you have at least one index containing vectors, you can perform vector sear
```swift copy
- import OramaCloud
+ import OramaCloudClient
struct MyDoc: Encodable & Decodable {
let title: String