# Full-text search (/docs/orm/prisma-client/queries/full-text-search)

Location: ORM > Prisma Client > Queries > Full-text search

Prisma Client supports full-text search for MySQL and for PostgreSQL with the `fullTextSearchPostgres` preview feature.

Enabling full-text search for PostgreSQL [#enabling-full-text-search-for-postgresql]

Add the preview flag to your generator and re-generate Prisma Client:

```prisma title="schema.prisma"
generator client {
  provider        = "prisma-client"
  output          = "./generated"
  previewFeatures = ["fullTextSearchPostgres"]
}
```

  

#### npm

```bash
npx prisma generate
```

#### pnpm

```bash
pnpm dlx prisma generate
```

#### yarn

```bash
yarn dlx prisma generate
```

#### bun

```bash
bunx --bun prisma generate
```

Search within a text field [#search-within-a-text-field]

```ts
const posts = await prisma.post.findMany({
  where: {
    body: {
      search: "cat | dog",
    },
  },
});
```

Sort by relevance [#sort-by-relevance]

Prisma Client also supports relevance-based ordering on supported databases:

```ts
const posts = await prisma.post.findMany({
  orderBy: {
    _relevance: {
      fields: ["title"],
      search: "database",
      sort: "desc",
    },
  },
});
```

Related pages [#related-pages]

* [Filtering and sorting](/orm/prisma-client/queries/filtering-and-sorting)
* [Prisma Client API reference](/orm/reference/prisma-client-reference#search)
* [Preview features](/orm/reference/preview-features/client-preview-features)

## Related pages

- [`Aggregation, grouping, and summarizing`](https://www.prisma.io/docs/orm/prisma-client/queries/aggregation-grouping-summarizing): Use Prisma Client to aggregate, group by, count, and select distinct.
- [`CRUD`](https://www.prisma.io/docs/orm/prisma-client/queries/crud): Learn how to perform create, read, update, and delete operations
- [`Excluding fields`](https://www.prisma.io/docs/orm/prisma-client/queries/excluding-fields): Learn how to exclude fields from Prisma Client results with the omit option.
- [`Filtering and sorting`](https://www.prisma.io/docs/orm/prisma-client/queries/filtering-and-sorting): Learn how to filter Prisma Client queries with where and sort results with orderBy.
- [`Pagination`](https://www.prisma.io/docs/orm/prisma-client/queries/pagination): Learn how to paginate Prisma Client query results with offset pagination and cursor-based pagination.