> For the complete documentation index, see [llms.txt](https://ra-libs.gitbook.io/nestjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ra-libs.gitbook.io/nestjs/utils/withqsearch.md).

# withQSeach

withQSearch adds the q filter to the query, it extracts it from the query and map it to the fields.

## Usage

```typescript
import { withQSearch } from '@ra-libs/nestjs'


  findAll(query: any): Promise<[Client[], number]> {
    query = withQSearch(query, ["firstName", "lastName", "email", "document", "cellphone"])
    const where = query.where || {};
    return this.prisma.$transaction([
      this.prisma.client.findMany(query),
      this.prisma.client.count({ where }),
    ]);
  }
```

In the example shown above the withQSearch will extract the q field value and search in firstName, lastName, email, document, cellphone fields.
