---
title: "Hybrid search"
description: "Hybrid search combining vector and keyword search with code examples in Python, TypeScript, Go, Java, and C#."
url: https://docs.weaviate.io/weaviate/search/hybrid
---

# Hybrid search

`Hybrid` search combines the results of a vector search and a keyword (BM25F) search by fusing the two result sets.

The [fusion method](https://docs.weaviate.io/weaviate/search/hybrid#change-the-fusion-method) and the [relative weights](https://docs.weaviate.io/weaviate/search/hybrid#balance-keyword-and-vector-search) are configurable.

> [!TIP]
>
> **Prefer natural language queries?**
>
> The [Query Agent](https://docs.weaviate.io/weaviate/search/query-agent) translates plain English questions into optimized Weaviate queries automatically - no manual query construction needed.

## Basic hybrid search

Combine the results of a vector search and a keyword search. The search uses a single query string.

**Python**

```python
jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(query="food", limit=3)

for o in response.objects:
    print(o.properties)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

const result = await jeopardy.query.hybrid('food', {
  limit: 2,
})

for (let object of result.objects) {
  console.log(JSON.stringify(object.properties, null, 2));
}
```

**Go (v5)**

```go
ctx := context.Background()
className := "JeopardyQuestion"
query := "food"
limit := 3

q := client.GraphQL().Get().
  WithClassName(className).
  WithFields(graphql.Field{Name: "question"}, graphql.Field{Name: "answer"}).
  WithHybrid(client.GraphQL().HybridArgumentBuilder().WithQuery(query)).
  WithLimit(limit)

result, err := q.Do(ctx)
```

**Go (v6)**

```go
jeopardy := client.Collections.Use("JeopardyQuestion")
response, err := jeopardy.Query.Hybrid(ctx, query.Hybrid{
  Query: "food",
  Limit: 3,
})
if err != nil {
  // handle error
  panic(err)
}
for _, obj := range response.Objects {
  fmt.Printf("%v\n", obj.Properties)
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid(
    "food", q -> q.limit(3)
);

for (var o : response.objects()) {
  System.out.println(o.properties());
}
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "food",
    limit: 3
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
}
```

**GraphQL**

```graphql
{
  Get {
    JeopardyQuestion(
      limit: 3
      hybrid: {
        query: "food"
      }
    ) {
      question
      answer
    }
  }
}
```

**Example response**

The output is like this:

```json
{
  "data": {
    "Get": {
      "JeopardyQuestion": [
        {
          "answer": "a closer grocer",
          "question": "A nearer food merchant"
        },
        {
          "answer": "Famine",
          "question": "From the Latin for \"hunger\", it's a period when food is extremely scarce"
        },
        {
          "answer": "Tofu",
          "question": "A popular health food, this soybean curd is used to make a variety of dishes & an ice cream substitute"
        }
      ]
    }
  }
}
```

## Named vectors

A hybrid search on a collection that has [named vectors](https://docs.weaviate.io/weaviate/config-refs/collections#named-vectors) must specify a `target` vector. Weaviate uses the query vector to search the target vector space.

**Python**

```python
reviews = client.collections.use("WineReviewNV")
response = reviews.query.hybrid(
    query="A French Riesling",
    target_vector="title_country",
    limit=3
)

for o in response.objects:
    print(o.properties)
```

**JavaScript/TypeScript**

```ts
const myNVCollection = client.collections.use('WineReviewNV');

const result = await myNVCollection.query.hybrid('a sweet German white wine', {
  targetVector: 'title_country',
  limit: 2,
})

for (let object of result.objects) {
  console.log(JSON.stringify(object.properties, null, 2));
}
```

**Java**

```java
```

**C#**

```csharp
var reviews = client.Collections.Use("WineReviewNV");
var response = await reviews.Query.Hybrid(
    vectors: v => v.NearText(["A French Riesling"]).TargetVectorsMinimum("title_country"),
    limit: 3
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
}
```

**GraphQL**

```graphql
{
  Get {
    WineReviewNV(
      limit: 2
      hybrid: {
        targetVectors: ["title_country"]
        query: "A French Riesling"
      }
    ) {
      title
      review_body
      country
    }
  }
}
```

**Example response**

The output is like this:

```json
```

## Explain the search results

To see the object rankings, set the `explain score` field in your query. The search rankings are part of the object metadata. Weaviate uses the score to order the search results.

**Python**

```python
from weaviate.classes.query import MetadataQuery

jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="food",
    alpha=0.5,
    return_metadata=MetadataQuery(score=True, explain_score=True),
    limit=3,
)

for o in response.objects:
    print(o.properties)
    print(o.metadata.score, o.metadata.explain_score)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

const result = await jeopardy.query.hybrid('food', {
  limit: 2,
  returnProperties: ['question', 'answer'],
  returnMetadata: ['score', 'explainScore']
})

for (let object of result.objects) {
  console.log(JSON.stringify(object.properties, null, 2));
  console.log(object.metadata?.score);
  console.log(object.metadata?.explainScore);
}
```

**Go (v5)**

```go
ctx := context.Background()
className := "JeopardyQuestion"
query := "food"
limit := 3

result, err := client.GraphQL().Get().
  WithClassName(className).
  WithFields(
  	graphql.Field{Name: "question"},
  	graphql.Field{Name: "answer"},
  	graphql.Field{Name: "_additional", Fields: []graphql.Field{{Name: "score"}, {Name: "explainScore"}}},
  ).
  WithHybrid(client.GraphQL().HybridArgumentBuilder().WithQuery(query)).
  WithLimit(limit).
  Do(ctx)
```

**Go (v6)**

```go
jeopardy := client.Collections.Use("JeopardyQuestion")
response, err := jeopardy.Query.Hybrid(ctx, query.Hybrid{
  Query: "food",
  Limit: 3,
  ReturnMetadata: query.ReturnMetadata{
    Score:        true,
    ExplainScore: true,
  },
})
if err != nil {
  // handle error
  panic(err)
}
for _, obj := range response.Objects {
  if obj.Metadata.Score != nil {
    fmt.Printf("score: %v\n", *obj.Metadata.Score)
  }
  if obj.Metadata.ExplainScore != nil {
    fmt.Printf("explain: %v\n", *obj.Metadata.ExplainScore)
  }
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid("food", q -> q.alpha(0.5f)
    .returnMetadata(Metadata.SCORE, Metadata.EXPLAIN_SCORE)
    .limit(3));

for (var o : response.objects()) {
  System.out.println(o.properties());
  System.out
      .println(o.queryMetadata().score() + " " + o.queryMetadata().explainScore());
}
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "food",
    alpha: 0.5f,
    returnMetadata: MetadataOptions.Score | MetadataOptions.ExplainScore,
    limit: 3
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
    Console.WriteLine(
        $"Score: {o.Metadata.Score}, Explain Score: {o.Metadata.ExplainScore}"
    );
}
```

**GraphQL**

```graphql
{
  Get {
    JeopardyQuestion(
      limit: 3
      hybrid: {
        query: "food"
      }
    ) {
      question
      answer
      _additional {
        score
        explainScore
      }
    }
  }
}
```

**Example response**

The output is like this:

```json
{
  "data": {
    "Get": {
      "JeopardyQuestion": [
        {
          "_additional": {
            "explainScore": "(bm25)\n(hybrid) Document df958a90-c3ad-5fde-9122-cd777c22da6c contributed 0.003968253968253968 to the score\n(hybrid) Document df958a90-c3ad-5fde-9122-cd777c22da6c contributed 0.012295081967213115 to the score",
            "score": "0.016263336"
          },
          "answer": "a closer grocer",
          "question": "A nearer food merchant"
        },
        {
          "_additional": {
            "explainScore": "(vector) [0.0223698 -0.02752683 -0.0061537363 0.0023812135 -0.00036100898 -0.0078375945 -0.018505432 -0.037500713 -0.0042215516 -0.012620432]...  \n(hybrid) Document ec776112-e651-519d-afd1-b48e6237bbcb contributed 0.012096774193548387 to the score",
            "score": "0.012096774"
          },
          "answer": "Famine",
          "question": "From the Latin for \"hunger\", it's a period when food is extremely scarce"
        },
        {
          "_additional": {
            "explainScore": "(vector) [0.0223698 -0.02752683 -0.0061537363 0.0023812135 -0.00036100898 -0.0078375945 -0.018505432 -0.037500713 -0.0042215516 -0.012620432]...  \n(hybrid) Document 98807640-cd16-507d-86a1-801902d784de contributed 0.011904761904761904 to the score",
            "score": "0.011904762"
          },
          "answer": "Tofu",
          "question": "A popular health food, this soybean curd is used to make a variety of dishes & an ice cream substitute"
        }
      ]
    }
  }
}
```

## Balance keyword and vector search

Hybrid search results can favor the keyword component or the vector component. To change the relative weights of the keyword and vector components, set the `alpha` value in your query.

- An `alpha` of `1` is a pure vector search.
- An `alpha` of `0` is a pure keyword search.

If you do not set `alpha`, the effective weighting depends on your client. See [Alpha parameter](https://docs.weaviate.io/weaviate/concepts/search/hybrid-search#alpha-parameter).

**Python**

```python
jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="food",
    alpha=0.25,
    limit=3,
)

for o in response.objects:
    print(o.properties)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

const result = await jeopardy.query.hybrid('food', {
  alpha: 0.25,
  limit: 3
})

for (let object of result.objects) {
  console.log(JSON.stringify(object.properties, null, 2));
}
```

**Go (v5)**

```go
ctx := context.Background()
className := "JeopardyQuestion"
query := "food"
limit := 3
alpha := float32(0.25)

result, err := client.GraphQL().Get().
  WithClassName(className).
  WithFields(graphql.Field{Name: "question"}, graphql.Field{Name: "answer"}).
  WithHybrid(client.GraphQL().HybridArgumentBuilder().
  	WithQuery(query).
  	WithAlpha(alpha),
  ).
  WithLimit(limit).
  Do(ctx)
```

**Go (v6)**

```go
jeopardy := client.Collections.Use("JeopardyQuestion")
response, err := jeopardy.Query.Hybrid(ctx, query.Hybrid{
  Query: "food",
  // Alpha of 0 is pure keyword search, 1 is pure vector search.
  Alpha: new(float32(0.25)),
  Limit: 3,
})
if err != nil {
  // handle error
  panic(err)
}
for _, obj := range response.Objects {
  fmt.Printf("%v\n", obj.Properties)
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid("food", q -> q
    .alpha(0.25f)
    .limit(3));

for (var o : response.objects()) {
  System.out.println(o.properties());
}
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "food",
    alpha: 0.25f,
    limit: 3
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
}
```

**GraphQL**

```graphql
{
  Get {
    JeopardyQuestion(
      limit: 3
      hybrid: {
        query: "food"
        alpha: 0.25
      }
    ) {
      question
      answer
    }
  }
}
```

**Example response**

The output is like this:

```json
{
  "data": {
    "Get": {
      "JeopardyQuestion": [
        {
          "answer": "a closer grocer",
          "question": "A nearer food merchant"
        },
        {
          "answer": "food stores (supermarkets)",
          "question": "This type of retail store sells more shampoo & makeup than any other"
        },
        {
          "answer": "cake",
          "question": "Devil's food & angel food are types of this dessert"
        }
      ]
    }
  }
}
```

## Change the fusion method

`Relative Score Fusion` is the default fusion method starting in `v1.24`.

- To use the keyword and vector search relative scores instead of the search rankings, use `Relative Score Fusion`.
- To use [`autocut`](https://docs.weaviate.io/weaviate/api/graphql/additional-operators#autocut) with the `hybrid` operator, use `Relative Score Fusion`.

**Python**

```python
from weaviate.classes.query import HybridFusion

jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="food",
    fusion_type=HybridFusion.RELATIVE_SCORE,
    limit=3,
)

for o in response.objects:
    print(o.properties)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

const result = await jeopardy.query.hybrid('food', {
  limit: 2,
  fusionType: 'RelativeScore', // can also be 'Ranked'
})

for (let object of result.objects) {
  console.log(JSON.stringify(object.properties, null, 2));
}
```

**Go (v5)**

```go
ctx := context.Background()
className := "JeopardyQuestion"
query := "food"
limit := 3
fusionType := "relativeScoreFusion"

result, err := client.GraphQL().Get().
  WithClassName(className).
  WithFields(graphql.Field{Name: "question"}, graphql.Field{Name: "answer"}).
  WithHybrid(client.GraphQL().HybridArgumentBuilder().
  	WithQuery(query).
  	WithFusionType(graphql.FusionType(fusionType)),
  ).
  WithLimit(limit).
  Do(ctx)
```

**Go (v6)**

```go
jeopardy := client.Collections.Use("JeopardyQuestion")
response, err := jeopardy.Query.Hybrid(ctx, query.Hybrid{
  Query: "food",
  Fusion: query.HybridFusionRelativeScore,
  Limit: 3,
})
if err != nil {
  // handle error
  panic(err)
}
for _, obj := range response.Objects {
  fmt.Printf("%v\n", obj.Properties)
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid("food", q -> q
    .fusionType(FusionType.RELATIVE_SCORE)
    .limit(3));

for (var o : response.objects()) {
  System.out.println(o.properties());
}
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "food",
    fusionType: HybridFusion.RelativeScore,
    limit: 3
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
}
```

**GraphQL**

```graphql
{
  Get {
    JeopardyQuestion(
      limit: 3
      hybrid: {
        query: "food"
        fusionType: relativeScoreFusion
      }
    ) {
      question
      answer
    }
  }
}
```

**Example response**

The output is like this:

```json
{
  "data": {
    "Get": {
      "JeopardyQuestion": [
        {
          "answer": "a closer grocer",
          "question": "A nearer food merchant"
        },
        {
          "answer": "food stores (supermarkets)",
          "question": "This type of retail store sells more shampoo & makeup than any other"
        },
        {
          "answer": "cake",
          "question": "Devil's food & angel food are types of this dessert"
        }
      ]
    }
  }
}
```

**Additional information**

For a discussion of fusion methods, see [this blog post](https://weaviate.io/blog/hybrid-search-fusion-algorithms) and [this reference page](https://docs.weaviate.io/weaviate/api/graphql/search-operators#fusion-algorithms).

## Keyword search operators

> [!NOTE]
>
> **Added in `v1.31`**

Keyword (BM25) search operators define how many of the query [tokens](https://docs.weaviate.io/weaviate/search/hybrid#tokenization) must match, and whether they must all match within a single searched property. The options are `or` (default), `and`, and `and_cross` (available from `v1.38.8`).

The keyword leg of a hybrid query accepts the same operators as a standalone keyword search. For `and_cross`, which matches every token across the searched properties combined, see [BM25 search: `and_cross`](https://docs.weaviate.io/weaviate/search/bm25#and_cross).

### `or`

With the `or` operator, the search returns objects that contain at least `minimumOrTokensMatch` of the tokens in the search string.

**Python**

```python
from weaviate.classes.query import BM25Operator

jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="Australian mammal cute",
    bm25_operator=BM25Operator.or_(minimum_match=2),
    limit=3,
)

for o in response.objects:
    print(o.properties)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

const response = await jeopardy.query.hybrid("Australian mammal cute", {
    bm25Operator: Bm25Operator.or({
      minimumMatch: 2
    }),
    limit: 3,
})

for (const object of response.objects) {
    console.log(object.properties)
}
```

**Go (v6)**

```go
jeopardy := client.Collections.Use("JeopardyQuestion")
response, err := jeopardy.Query.Hybrid(ctx, query.Hybrid{
  Query: "Australian mammal cute",
  // The keyword half matches objects containing at least this many of
  // the query tokens. The vector half is unaffected.
  KeywordSimilarity: query.MinimumTokensMatch(2),
  Limit: 3,
})
if err != nil {
  // handle error
  panic(err)
}
for _, obj := range response.Objects {
  fmt.Printf("%v\n", obj.Properties)
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid(
    "Australian mammal cute", c -> c.searchOperator(SearchOperator.or(2))
        .limit(3));

for (var o : response.objects()) {
  System.out.println(o.properties());
}
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "Australian mammal cute",
    bm25Operator: new BM25Operator.Or(MinimumMatch: 1),
    limit: 3
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
}
```

**GraphQL**

```python
{
  Get {
    JeopardyQuestion(
      limit: 3
      hybrid: {
        query: "Australian mammal cute"
        bm25SearchOperator: {
          operator: Or,
          minimumOrTokensMatch: 2
        }
      }
    ) {
      question
      answer
    }
  }
}
```

### `and`

With the `and` operator, the search returns objects where all tokens in the search string appear together within a single searched property.

**Python**

```python
from weaviate.classes.query import BM25Operator

jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="Australian mammal cute",
    bm25_operator=BM25Operator.and_(),  # Each result must include all tokens (e.g. "australian", "mammal", "cute")
    limit=3,
)

for o in response.objects:
    print(o.properties)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

const response = await jeopardy.query.hybrid(
    "Australian mammal cute", {
    bm25Operator: Bm25Operator.and(), // Each result must include all tokens (e.g. "australian", "mammal", "cute")
    limit: 3,
})

for (const object of response.objects) {
    console.log(object.properties)
}
```

**Go (v6)**

```go
jeopardy := client.Collections.Use("JeopardyQuestion")
response, err := jeopardy.Query.Hybrid(ctx, query.Hybrid{
  Query: "Australian mammal cute",
  // Every token must appear together in a single searched property for
  // the keyword half to match.
  KeywordSimilarity: query.AllTokensMatch,
  Limit: 3,
})
if err != nil {
  // handle error
  panic(err)
}
for _, obj := range response.Objects {
  fmt.Printf("%v\n", obj.Properties)
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid(
    "Australian mammal cute"
// .bm25Operator(BM25Operator.and()) // Each result must include all tokens
// (e.g. "australian", "mammal", "cute")
// .limit(3)
);

for (var o : response.objects()) {
  System.out.println(o.properties());
}
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "Australian mammal cute",
    bm25Operator: new BM25Operator.And(), // Each result must include all tokens
    limit: 3
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
}
```

**GraphQL**

```python
{
  Get {
    JeopardyQuestion(
      limit: 3
      hybrid: {
        query: "Australian mammal cute"
        bm25SearchOperator: {
          operator: And,
        }
      }
    ) {
      question
      answer
    }
  }
}
```

## Specify keyword search properties

The keyword search portion of hybrid search can be directed to only search a subset of object properties. This does not affect the vector search portion.

**Python**

```python
jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="food",
    query_properties=["question"],
    alpha=0.25,
    limit=3,
)

for o in response.objects:
    print(o.properties)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

const result = await jeopardy.query.hybrid('food', {
  queryProperties: ['question'],
  alpha: 0.25,
  limit: 3
})

for (let object of result.objects) {
  console.log(JSON.stringify(object.properties, null, 2));
}
```

**Go (v5)**

```go
ctx := context.Background()
className := "JeopardyQuestion"
query := "food"
limit := 3
alpha := float32(0.25)
properties := []string{"question"}

result, err := client.GraphQL().Get().
  WithClassName(className).
  WithFields(graphql.Field{Name: "question"}, graphql.Field{Name: "answer"}).
  WithHybrid(client.GraphQL().HybridArgumentBuilder().
  	WithQuery(query).
  	WithAlpha(alpha).
  	WithProperties(properties),
  ).
  WithLimit(limit).
  Do(ctx)
```

**Go (v6)**

```go
jeopardy := client.Collections.Use("JeopardyQuestion")
response, err := jeopardy.Query.Hybrid(ctx, query.Hybrid{
  Query: "food",
  // Restrict the keyword search to these properties.
  QueryProperties: []string{"question", "answer"},
  Limit: 3,
})
if err != nil {
  // handle error
  panic(err)
}
for _, obj := range response.Objects {
  fmt.Printf("%v\n", obj.Properties)
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid("food", q -> q
    .queryProperties("question")
    .alpha(0.25f)
    .limit(3));

for (var o : response.objects()) {
  System.out.println(o.properties());
}
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "food",
    queryProperties: ["question"],
    alpha: 0.25f,
    limit: 3
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
}
```

**GraphQL**

```graphql
{
  Get {
    JeopardyQuestion(
      limit: 3
      hybrid: {
        query: "food"
        properties: ["question"]
        alpha: 0.25
      }
    ) {
      question
      answer
    }
  }
}
```

**Example response**

The output is like this:

```json
{
  "data": {
    "Get": {
      "JeopardyQuestion": [
        {
          "answer": "a closer grocer",
          "question": "A nearer food merchant"
        },
        {
          "answer": "cake",
          "question": "Devil's food & angel food are types of this dessert"
        },
        {
          "answer": "honey",
          "question": "The primary source of this food is the Apis mellifera"
        }
      ]
    }
  }
}
```

## Set weights on property values

Specify the relative value of an object's `properties` in the keyword search. Higher values increase the property's contribution to the search score.

**Python**

```python
jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="food",
    query_properties=["question^2", "answer"],
    alpha=0.25,
    limit=3,
)

for o in response.objects:
    print(o.properties)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

const result = await jeopardy.query.hybrid('food', {
  queryProperties: ['question^2', 'answer'],
  alpha: 0.25,
  limit: 3
})

for (let object of result.objects) {
  console.log(JSON.stringify(object.properties, null, 2));
}
```

**Go (v5)**

```go
ctx := context.Background()
className := "JeopardyQuestion"
query := "food"
limit := 3
alpha := float32(0.25)
properties := []string{"question^2", "answer"}

result, err := client.GraphQL().Get().
  WithClassName(className).
  WithFields(graphql.Field{Name: "question"}, graphql.Field{Name: "answer"}).
  WithHybrid(client.GraphQL().HybridArgumentBuilder().
  	WithQuery(query).
  	WithAlpha(alpha).
  	WithProperties(properties),
  ).
  WithLimit(limit).
  Do(ctx)
```

**Go (v6)**

```go
jeopardy := client.Collections.Use("JeopardyQuestion")
response, err := jeopardy.Query.Hybrid(ctx, query.Hybrid{
  Query: "food",
  // Boost the "question" property with the ^ operator.
  QueryProperties: []string{"question^2", "answer"},
  Limit: 3,
})
if err != nil {
  // handle error
  panic(err)
}
for _, obj := range response.Objects {
  fmt.Printf("%v\n", obj.Properties)
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid("food", q -> q
    .queryProperties("question^2", "answer")
    .alpha(0.25f)
    .limit(3));

for (var o : response.objects()) {
  System.out.println(o.properties());
}
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "food",
    queryProperties: ["question^2", "answer"],
    alpha: 0.25f,
    limit: 3
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
}
```

**GraphQL**

```graphql
{
  Get {
    JeopardyQuestion(
      limit: 3
      hybrid: {
        query: "food"
        properties: ["question^2", "answer"]
        alpha: 0.25
      }
    ) {
      question
      answer
    }
  }
}
```

**Example response**

The output is like this:

```json
{
  "data": {
    "Get": {
      "JeopardyQuestion": [
        {
          "answer": "a closer grocer",
          "question": "A nearer food merchant"
        },
        {
          "answer": "cake",
          "question": "Devil's food & angel food are types of this dessert"
        },
        {
          "answer": "food stores (supermarkets)",
          "question": "This type of retail store sells more shampoo & makeup than any other"
        }
      ]
    }
  }
}
```

## Specify a search vector

The vector component of hybrid search can use a query string or a query vector. To specify a query vector instead of a query string, provide a query vector (for the vector search) and a query string (for the keyword search) in your query.

**Python**

```python
query_vector = [-0.02] * 1536  # Some vector that is compatible with object vectors

jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="food",
    vector=query_vector,
    alpha=0.25,
    limit=3,
)

for o in response.objects:
    print(o.properties)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');
let queryVector = Array(1536).fill(0.12345) // Query vector [0.12345, 0.12345, 0.12345...]

const result = await jeopardy.query.hybrid('food', {
  vector: queryVector,
  alpha: 0.25,
  limit: 3
})

for (let object of result.objects) {
  console.log(JSON.stringify(object.properties, null, 2));
}
```

**Go (v5)**

```go
ctx := context.Background()
className := "JeopardyQuestion"
query := "food"
limit := 3
//Create a vector 384 dimensions long

// Define the length of the slice
length := 384

// Initialize the slice with the specified length
values := make([]float32, length)

// Fill the slice with values
for i := 0; i < length; i++ {
  values[i] = 0.1 * float32(i+1)
}

vector := values

result, err := client.GraphQL().Get().
  WithClassName(className).
  WithFields(graphql.Field{Name: "question"}, graphql.Field{Name: "answer"}).
  WithHybrid(client.GraphQL().HybridArgumentBuilder().
  	WithQuery(query).
  	WithVector(vector),
  ).
  WithLimit(limit).
  Do(ctx)
```

**Go (v6)**

```go
// A query vector, for example an embedding produced by your model.
vector := []float32{0.12, 0.20, 0.33}

jeopardy := client.Collections.Use("JeopardyQuestion")
response, err := jeopardy.Query.Hybrid(ctx, query.Hybrid{
  Query: "food",
  // Supply the vector for the vector-search half of the query.
  NearVector: &query.NearVector{
    Target: &types.Vector{Single: vector},
  },
  Alpha: new(float32(0.25)),
  Limit: 3,
})
if err != nil {
  // handle error
  panic(err)
}
for _, obj := range response.Objects {
  fmt.Printf("%v\n", obj.Properties)
}
```

**Java**

```java
float[] queryVector = new float[1536]; // Some vector that is compatible with object vectors
for (int i = 0; i < queryVector.length; i++) {
  queryVector[i] = -0.02f;
}

CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid("food", q -> q
    // .nearVector(NearVector.of(queryVector))
    .alpha(0.25f)
    .limit(3));

for (var o : response.objects()) {
  System.out.println(o.properties());
}
```

**C#**

```csharp
var queryVector = Enumerable.Repeat(-0.02f, 1536).ToArray();

var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "food",
    vectors: queryVector,
    alpha: 0.25f,
    limit: 3
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
}
```

**GraphQL**

```graphql
{
  Get {
    JeopardyQuestion(
      limit: 3
      hybrid: {
        query: "food"
        vector: [0.013085687533020973, -0.00777443777769804, 0.005439540836960077, ...]
      }
    ) {
      question
      answer
    }
  }
}
```

*This example's 1,536-number vector is shortened to its first 3 values. The HTML page has the full vector.*

**Example response**

The output is like this:

```json
{
  "data": {
    "Get": {
      "JeopardyQuestion": [
        {
          "answer": "Risotto",
          "question": "From the Italian word for rice, it's a rice dish cooked with broth & often grated cheese"
        },
        {
          "answer": "arrabiata",
          "question": "Italian for \"angry\", it describes a pasta sauce spiced up with plenty of chiles"
        },
        {
          "answer": "Fettucine Alfredo",
          "question": "Ribbon-shaped noodles, sweet butter, cream, parmesan cheese & black pepper make up this pasta dish"
        }
      ]
    }
  }
}
```

## Vector search parameters

You can specify [vector similarity search](https://docs.weaviate.io/weaviate/search/similarity) parameters similar to [near text](https://docs.weaviate.io/weaviate/search/similarity#search-with-text) or [near vector](https://docs.weaviate.io/weaviate/search/similarity#search-with-a-vector) searches, such as `group by` and `move to` / `move away`. An equivalent `distance` [threshold for vector search](https://docs.weaviate.io/weaviate/search/similarity#set-a-similarity-threshold) can be specified with the `max vector distance` parameter.

**Python**

```python
from weaviate.classes.query import HybridVector, Move, HybridFusion

jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="California",
    max_vector_distance=0.4,  # Maximum threshold for the vector search component
    vector=HybridVector.near_text(
        query="large animal",
        move_away=Move(force=0.5, concepts=["mammal", "terrestrial"]),
    ),
    alpha=0.75,
    limit=5,
)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

const result = await jeopardy.query.hybrid('California', {
  maxVectorDistance: 0.4, // Maximum threshold for the vector search component
  vector: {
    query: 'large animal',
    moveAway: { force: 0.5, concepts: ['mammal', 'terrestrial'] }
  },
  alpha: 0.75,
  limit: 5,

})

for (let object of result.objects) {
  console.log(JSON.stringify(object.properties, null, 2));
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");

var intermediateResponse = jeopardy.query
    .nearText("large animal",
        c -> c.moveAway(0.5f,
            from -> from.concepts("mammal", "terrestrial")))
    .objects()
    .get(0)
    .vectors()
    .getDefaultSingle();

var response = jeopardy.query.hybrid("California", q -> q
    .maxVectorDistance(0.4f)
    .nearVector(NearVector.of(intermediateResponse))
    .alpha(0.75f)
    .limit(5));
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");

var response = await jeopardy.Query.Hybrid(
    "California",
    maxVectorDistance: 0.4f,
    vectors: v =>
        v.NearText(
            "large animal",
            moveAway: new Move(force: 0.5f, concepts: ["mammal", "terrestrial"])
        ),
    alpha: 0.75f,
    limit: 5
);
```

**Example response**

The output is like this:

```json
{
  "data": {
    "Get": {
      "JeopardyQuestion": [
        {
          "answer": "Rhinoceros",
          "points": 400,
          "question": "The \"black\" species of this large horned mammal can grasp twigs with its upper lip"
        },
        {
          "answer": "the hippopotamus",
          "points": 400,
          "question": "Close relative of the pig, though its name means \"river horse\""
        },
        {
          "answer": "buffalo",
          "points": 400,
          "question": "Animal that was the main staple of the Plains Indians economy"
        },
        {
          "answer": "California",
          "points": 200,
          "question": "Its state animal is the grizzly bear, & the state tree is a type of redwood"
        },
        {
          "answer": "California",
          "points": 200,
          "question": "This western state sent its first refrigerated trainload of oranges back east February 14, 1886"
        }
      ]
    }
  }
}
```

## Hybrid search thresholds

The only available search threshold is `max vector distance`, which will set the maximum allowable distance for the vector search component.

**Python**

```python
from weaviate.classes.query import HybridVector, Move, HybridFusion

jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="California",
    max_vector_distance=0.4,  # Maximum threshold for the vector search component
    alpha=0.75,
    limit=5,
)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

const response = await jeopardy.query.hybrid("California", {
  alpha: 0.75,
  maxVectorDistance: 0.4,  // Maximum threshold for the vector search component
  limit: 5,
})
```

**Java**

```java
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid("California", q -> q
    .maxVectorDistance(0.4f) // Maximum threshold for the vector search component
    .alpha(0.75f)
    .limit(5));
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "California",
    maxVectorDistance: 0.4f, // Maximum threshold for the vector search component
    alpha: 0.75f,
    limit: 5
);
```

## Group results

Define criteria to group search results.

**Python**

```py
# Grouping parameters
group_by = GroupBy(
    prop="round",  # group by this property
    objects_per_group=3,  # maximum objects per group
    number_of_groups=2,  # maximum number of groups
)

# Query
jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    alpha=0.75,
    query="California",
    group_by=group_by
)

for grp_name, grp_content in response.groups.items():
    print(grp_name, grp_content.objects)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');
// Grouping parameters
const groupByProperties = {
  property: "round", // group by this property
  objectsPerGroup: 3, // maximum objects per group
  numberOfGroups: 2 // maximum number of groups
}

const response = await jeopardy.query.hybrid('California', {
  alpha: 0.75,
  groupBy: groupByProperties
})


for (let groupName in response.groups) {
  console.log(groupName)
  // Uncomment to view group objects 
  // console.log(response.groups[groupName].objects)
}
```

**Java**

```java
// Query
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid("California", q -> q.alpha(0.75f),
    GroupBy.property("round", // group by this property
        2, // maximum number of groups
        3 // maximum objects per group
    ));

response.groups().forEach((groupName, group) -> {
  System.out.println(group.name() + " " + group.objects());
});
```

**C#**

```csharp
// Query
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "California",
    alpha: 0.75f,
    groupBy: new GroupByRequest("round") // group by this property
    {
        NumberOfGroups = 2, // maximum number of groups
        ObjectsPerGroup = 3, // maximum objects per group
    }
);

foreach (var group in response.Groups.Values)
{
    Console.WriteLine($"{group.Name} {JsonSerializer.Serialize(group.Objects)}");
}
```

**Example response**

The response is like this:

```text
'Jeopardy!'
'Double Jeopardy!'
```

## `limit` & `offset`

Use `limit` to set a fixed maximum number of objects to return.

Optionally, use `offset` to paginate the results.

`offset` + `limit` cannot exceed [`QUERY_MAXIMUM_RESULTS`](https://docs.weaviate.io/deploy/configuration/env-vars#QUERY_MAXIMUM_RESULTS) (default `10000`). A query past that ceiling returns an error rather than a truncated result set, and for a ranked search the ceiling is hard: narrow the query with filters, or raise `QUERY_MAXIMUM_RESULTS` (a higher value costs memory and query time). To iterate over every object without ranking, use a [cursor](https://docs.weaviate.io/weaviate/manage-objects/read-all-objects) instead, as cursors do not work with ranked searches.

**Python**

```py
jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="food",
    limit=3,
    offset=1
)

for o in response.objects:
    print(o.properties)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

const result = await jeopardy.query.hybrid('safety', {
  limit: 3,
  offset: 1
})

for (let object of result.objects) {
  console.log(JSON.stringify(object.properties, null, 2));
}
```

**Go (v5)**

```go
ctx := context.Background()
className := "JeopardyQuestion"
query := "safety"
limit := 3

result, err := client.GraphQL().Get().
  WithClassName(className).
  WithFields(
  	graphql.Field{Name: "question"},
  	graphql.Field{Name: "answer"},
  	graphql.Field{Name: "_additional", Fields: []graphql.Field{{Name: "score"}}},
  ).
  WithHybrid(client.GraphQL().HybridArgumentBuilder().WithQuery(query)).
  WithLimit(limit).
  Do(ctx)
```

**Go (v6)**

```go
jeopardy := client.Collections.Use("JeopardyQuestion")
response, err := jeopardy.Query.Hybrid(ctx, query.Hybrid{
  Query: "food",
  Limit:  3,
  Offset: 1,
})
if err != nil {
  // handle error
  panic(err)
}
for _, obj := range response.Objects {
  fmt.Printf("%v\n", obj.Properties)
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid("food", q -> q
    .limit(3)
    .offset(1)
);

for (var o : response.objects()) {
  System.out.println(o.properties());
}
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "food",
    limit: 3,
    offset: 1
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
}
```

**GraphQL**

```graphql
{
  Get {
    JeopardyQuestion(
      hybrid: {
        query: "safety"
      }
      limit: 3
    ) {
      question
      answer
      _additional {
        score
      }
    }
  }
}
```

## Limit result groups

To limit results to groups with similar distances from the query, use the [`autocut`](https://docs.weaviate.io/weaviate/api/graphql/additional-operators#autocut) filter. Specify the `Relative Score Fusion` ranking method when you use autocut with hybrid search.

> [!NOTE]
>
> Autocut requires `Relative Score Fusion` method because it uses actual similarity scores to detect cutoff points. Autocut shouldn't be used with `Ranked Fusion` as this fusion method relies on ranking positions, not similarity scores.
>
> To learn more about the different fusion algorithms, visit the [search operators reference page](https://docs.weaviate.io/weaviate/api/graphql/search-operators#fusion-algorithms).

**Python**

```py
from weaviate.classes.query import HybridFusion

jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="food",
    fusion_type=HybridFusion.RELATIVE_SCORE,
    auto_limit=1
)

for o in response.objects:
    print(o.properties)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

  const result = await jeopardy.query.hybrid('safety', {
    fusionType: 'RelativeScore',
    autoLimit: 1
  })

  for (let object of result.objects) {
    console.log(JSON.stringify(object.properties, null, 2));
  }
```

**Go (v5)**

```go
ctx := context.Background()
className := "JeopardyQuestion"
query := "safety"
autocut := 1

result, err := client.GraphQL().Get().
  WithClassName(className).
  WithFields(
  	graphql.Field{Name: "question"},
  	graphql.Field{Name: "answer"},
  	graphql.Field{Name: "_additional", Fields: []graphql.Field{{Name: "score"}}},
  ).
  WithHybrid(client.GraphQL().HybridArgumentBuilder().WithQuery(query)).
  WithAutocut(autocut).
  Do(ctx)
```

**Go (v6)**

```go
jeopardy := client.Collections.Use("JeopardyQuestion")
response, err := jeopardy.Query.Hybrid(ctx, query.Hybrid{
  Query: "food",
  AutoLimit: 1,
})
if err != nil {
  // handle error
  panic(err)
}
for _, obj := range response.Objects {
  fmt.Printf("%v\n", obj.Properties)
}
```

**Java**

```java
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "food",
    fusionType: HybridFusion.RelativeScore,
    autoLimit: 1
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
}
```

**GraphQL**

```graphql
{
  Get {
    JeopardyQuestion(
      hybrid: {
        query: "safety"
      }
      autocut: 1
    ) {
      question
      answer
      _additional {
        score
      }
    }
  }
}
```

**Example response**

The output is like this:

```json
{
  "data": {
    "Get": {
      "JeopardyQuestion": [
        {
          "answer": "Guards",
          "question": "Life, Security, Shin",
          "_additional": {
            "score": "0.75"
          },
        },
        # ... trimmed for brevity
      ]
    }
  }
}
```

## Filter results

To narrow your search results, use a [`filter`](https://docs.weaviate.io/weaviate/api/graphql/filters).

**Python**

```python
from weaviate.classes.query import Filter


jeopardy = client.collections.use("JeopardyQuestion")
response = jeopardy.query.hybrid(
    query="food",
    filters=Filter.by_property("round").equal("Double Jeopardy!"),
    limit=3,
)

for o in response.objects:
    print(o.properties)
```

**JavaScript/TypeScript**

```ts
const jeopardy = client.collections.use('JeopardyQuestion');

const result = await jeopardy.query.hybrid('food', {
  filters: jeopardy.filter.byProperty('round').equal('Double Jeopardy!'),
  limit: 3,
})

for (let object of result.objects) {
  console.log(JSON.stringify(object.properties, null, 2));
}
```

**Go (v5)**

```go
ctx := context.Background()
className := "JeopardyQuestion"
query := "food"
limit := 3

filter := filters.Where().
  WithPath([]string{"round"}).
  WithOperator(filters.Equal).
  WithValueString("Double Jeopardy!")

result, err := client.GraphQL().Get().
  WithClassName(className).
  WithFields(graphql.Field{Name: "question"}, graphql.Field{Name: "answer"}, graphql.Field{Name: "round"}).
  WithHybrid(client.GraphQL().HybridArgumentBuilder().WithQuery(query)).
  WithWhere(filter).
  WithLimit(limit).
  Do(ctx)
```

**Go (v6)**

```go
jeopardy := client.Collections.Use("JeopardyQuestion")
response, err := jeopardy.Query.Hybrid(ctx, query.Hybrid{
  Query: "food",
  Limit: 3,
  Filter: &filter.Cond{
    Target:   "round",
    Operator: filter.Equal,
    Value:    "Double Jeopardy!",
  },
})
if err != nil {
  // handle error
  panic(err)
}
for _, obj := range response.Objects {
  fmt.Printf("%v\n", obj.Properties)
}
```

**Java**

```java
CollectionHandle<Map<String, Object>> jeopardy =
    client.collections.use("JeopardyQuestion");
var response = jeopardy.query.hybrid("food", q -> q
    .filters(Filter.property("round").eq("Double Jeopardy!"))
    .limit(3));

for (var o : response.objects()) {
  System.out.println(o.properties());
}
```

**C#**

```csharp
var jeopardy = client.Collections.Use("JeopardyQuestion");
var response = await jeopardy.Query.Hybrid(
    "food",
    filters: Filter.Property("round").IsEqual("Double Jeopardy!"),
    limit: 3
);

foreach (var o in response.Objects)
{
    Console.WriteLine(JsonSerializer.Serialize(o.Properties));
}
```

**GraphQL**

```graphql
{
  Get {
    JeopardyQuestion(
      limit: 3
      hybrid: {
        query: "food"
      }
      where: {
        path: ["round"]
        operator: Equal
        valueText: "Double Jeopardy!"
      }
    ) {
      question
      answer
      round
    }
  }
}
```

**Example response**

The output is like this:

```json
{
  "data": {
    "Get": {
      "JeopardyQuestion": [
        {
          "answer": "food stores (supermarkets)",
          "question": "This type of retail store sells more shampoo & makeup than any other",
          "round": "Double Jeopardy!"
        },
        {
          "answer": "Tofu",
          "question": "A popular health food, this soybean curd is used to make a variety of dishes & an ice cream substitute",
          "round": "Double Jeopardy!"
        },
        {
          "answer": "gastronomy",
          "question": "This word for the art & science of good eating goes back to Greek for \"belly\"",
          "round": "Double Jeopardy!"
        }
      ]
    }
  }
}
```

### Tokenization

Weaviate converts filter terms into tokens. The default tokenization is `word`. The `word` tokenizer keeps alphanumeric characters, lowercase them and splits on whitespace. It converts a string like "Test\_domain\_weaviate" into "test", "domain", and "weaviate".

For details and additional tokenization methods, see [Tokenization](https://docs.weaviate.io/weaviate/config-refs/collections#tokenization).

## Soft-rank with Boost

> [!NOTE]
>
> **Added in `v1.38`**

Hybrid queries accept an optional `boost` argument that promotes or demotes matching documents without removing them. This is useful for biasing results by recency, popularity, a soft filter, or another property.

The boost runs once over the **fused** hybrid result. The BM25 and vector sub-search legs do not see the boost themselves. Hybrid's own `alpha` blend runs first, and the boost rescores the fused candidate pool on top.

See [Boost](https://docs.weaviate.io/weaviate/search/boost) for the supported condition types (filter, property value, time decay, numeric decay), curve choices, blending semantics, and depth tuning.

## Diversity selection (MMR)

> [!NOTE]
>
> **Added in `v1.38.6`**

Hybrid search fuses a keyword result set and a vector result set, which often means the top of the fused list is a cluster of near-duplicates. **Maximal Marginal Relevance (MMR)** reranks that list to balance relevance with diversity, so that each selected object adds something new to the result set.

Diversity selection runs after fusion. Both search legs run first, their results are fused with the configured `alpha` and fusion method, and the diversity pass then picks a diverse subset of the fused candidates.

**Python**

```python
from weaviate.classes.query import Diversity

collection = client.collections.get("MMRDemo")

# Fuse the keyword and vector results into 20 candidates, then select 5 diverse results
response = collection.query.hybrid(
    query="Question",
    vector=base_vec,
    limit=20,
    diversity_selection=Diversity.mmr(
        limit=5,
        balance=0.5,
    ),
)

for o in response.objects:
    print(o.properties["question"])
```

Important notes:

- **Top-level only**: set diversity selection on the hybrid query itself. Setting it on a sub-search is rejected with an error.
- **Two limits**: the query's top-level `limit` is the candidate window that gets diversified, and the diversity `limit` is the number of results returned. The diversity `limit` must be at least `1` and no larger than the query `limit`.
- **Ordering**: results come back in MMR order, not fused-score order.
- **Pagination**: `offset` moves the candidate window, so it must advance by the query `limit`, not by the number of returned objects. Weaviate does not validate this, and getting it wrong silently repeats some objects across pages while skipping others. See [Pagination](https://docs.weaviate.io/weaviate/search/similarity#pagination).
- **Not supported**: multi-vector collections. Weaviate rejects these queries with an error.

For the parameters, the relevance and diversity trade-off, and vector search examples, see [Diversity selection (MMR)](https://docs.weaviate.io/weaviate/search/similarity#diversity-selection-mmr).

## Related pages

- [Connect to Weaviate](https://docs.weaviate.io/weaviate/connections)
- [API References: Search operators # Hybrid](https://docs.weaviate.io/weaviate/api/graphql/search-operators#hybrid)
- About [hybrid fusion algorithms](https://weaviate.io/blog/hybrid-search-fusion-algorithms).
- For search using the GraphQL API, see [GraphQL API](https://docs.weaviate.io/weaviate/api/graphql/get).
