---
title: Phrase
noindex: true
---

<Danger>
  **Legacy Docs:** This page describes our legacy API. It will be deprecated in
  a future version. Please use the [v2 API](/) where possible.
</Danger>

## Basic Usage

Searches for documents containing a phrase.

<CodeGroup>
```sql Function Syntax
SELECT description, rating, category
FROM mock_items
WHERE id @@@ paradedb.phrase('description', ARRAY['running', 'shoes']);
```
```sql JSON Syntax
SELECT description, rating, category
FROM mock_items
WHERE id @@@
'{
    "phrase": {
        "field": "description",
        "phrases": ["running", "shoes"]
    }
}'::jsonb;
```
</CodeGroup>

<div className="mt-8" />

<ParamField body="field" required>
  Specifies the field within the document to search for the term.
</ParamField>
<ParamField body="phrases" required>
  An `ARRAY` of words that form the search phrase. These words must appear in
  the specified order within the document for a match to occur, although some
  flexibility is allowed based on the `slop` parameter.
</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.

<CodeGroup>
```sql Function Syntax
SELECT description, rating, category
FROM mock_items
WHERE id @@@ paradedb.phrase('description', ARRAY['sleek', 'shoes'], slop => 1);
```
```sql JSON Syntax
SELECT description, rating, category
FROM mock_items
WHERE id @@@
'{
    "phrase": {
        "field": "description",
        "phrases": ["sleek", "shoes"],
        "slop": 1
    }
}'::jsonb;
```
</CodeGroup>
