---
title: Query Parser
description: Accept raw user-provided query strings
canonical: https://docs.paradedb.com/documentation/query-builder/compound/query-parser
---

The parse query accepts a [Tantivy query string](https://docs.rs/tantivy/latest/tantivy/query/struct.QueryParser.html).
The intended use case is for accepting raw query strings provided by the end user.

To use it, pass the [key field](/documentation/indexing/create-index#choosing-a-key-field) to the left-hand side of `@@@` and `pdb.parse('<query>')` to the right-hand side.

```sql
SELECT description, rating, category FROM mock_items
WHERE id @@@ pdb.parse('description:(sleek shoes) AND rating:>3');
```

Please refer to the [Tantivy docs](https://docs.rs/tantivy/latest/tantivy/query/struct.QueryParser.html) for an overview of
the query string language.

## Lenient Parsing

By default, strict syntax parsing is used. This means that if any part of the query does not conform to Tantivy’s query string syntax, the query fails. For instance, a valid field name must be provided before every query (i.e. `category:footwear`).
By setting `lenient` to `true`, the query is executed on a best-effort basis. For example, if no field names are provided, the query is executed over all fields in the index.

```sql
SELECT description, rating, category FROM mock_items
WHERE id @@@ pdb.parse('description:(sleek shoes) AND rating:>3', lenient => true);
```

## Conjunction Mode

By default, terms in the query string are `OR`ed together. With `conjunction_mode` set to `true`, they are instead `AND`ed together.
For instance, the following query returns documents containing both `sleek` and `shoes`.

```sql
SELECT description, rating, category FROM mock_items
WHERE id @@@ pdb.parse('description:(sleek shoes)', conjunction_mode => true);
```
