---
title: Phrase
description: The query builder version of the phrase query
canonical: https://docs.paradedb.com/documentation/query-builder/phrase/phrase
---

Under the hood, the [phrase operator](/documentation/full-text/phrase) gets rewritten to this query builder function.
By default we recommend using the [phrase operator](/documentation/full-text/term) instead of this function.

## Basic Usage

Searches for documents containing a phrase.

<CodeGroup>
```sql SQL
SELECT description, rating, category
FROM mock_items
WHERE description @@@ pdb.phrase(ARRAY['running', 'shoes']);
```

```python Django
from paradedb import ParadeDB, Phrase

MockItem.objects.filter(
    description=ParadeDB(Phrase('running shoes'))
).values('description', 'rating', 'category')
```

```ruby Rails
MockItem.search(:description)
        .phrase("running shoes")
        .select(:description, :rating, :category)
```

</CodeGroup>

<div className="mt-8" />

<ParamField body="phrases" required>
  An `ARRAY` of tokens that form the search phrase. These tokens must appear in
  the specified order within the document for a match to occur, although some
  flexibility is allowed based on the `slop` parameter. Because these are
  tokens, they are not processed further.
</ParamField>
<ParamField body="slop" default={0}>
  A slop of `0` requires the terms to appear exactly as they are in the phrase
  and adjacent to each other. Higher slop values allow for more distance between
  the terms.
</ParamField>

Setting slop equal to `n` allows `n` terms to come in between the terms in the phrase as well
as term transpositions.

<CodeGroup>
```sql SQL
SELECT description, rating, category
FROM mock_items
WHERE description @@@ pdb.phrase(ARRAY['running', 'shoes'], 1);
```

```python Django
from paradedb import ParadeDB, Phrase

MockItem.objects.filter(
    description=ParadeDB(Phrase('running shoes', slop=1))
).values('description', 'rating', 'category')
```

```ruby Rails
MockItem.search(:description)
        .phrase("running shoes", slop: 1)
        .select(:description, :rating, :category)
```

</CodeGroup>
