> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Solr Query Language Cheat Sheet

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[localhost link]: http://localhost:3000/docs/4/fusion-server/reference/query-ops/query-language-cheat-sheet

[mintlify link]: https://doc.lucidworks.com/docs/4/fusion-server/reference/query-ops/query-language-cheat-sheet

[old doc.lw link]: https://doc.lucidworks.com/fusion-server/4.2/394

This cheat sheet is a quick reference to the Solr query language. Use this syntax when querying Fusion via the [Query API](/docs/4/fusion-server/reference/api/query/query-api)

There are two ways to query a Fusion collection using the parameters below:

* Enter query parameters in the [Query Workbench](/docs/4/fusion-server/concepts/querying/query-workbench) or the Quickstart.
* Append query parameters to the [`/query/{id}` endpoint](/docs/4/fusion-server/reference/api/query/query-api).

Wildcards and regular expressions are supported.

<LwTemplate />

## Wildcards

* `?` Single-character wildcard
* `*` Multi-character wildcard

## Common query parameters

|         |                                                                                                                                                                                                                                                                     |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `q`     | The full Solr query, using [Lucene query syntax](https://lucene.apache.org/core/2_9_4/queryparsersyntax.html).                                                                                                                                                      |
| `fq`    | [Filter query](https://solr.apache.org/guide/6_6/common-query-parameters.html#CommonQueryParameters-Thefq_FilterQuery_Parameter). A query string that limits the query results without influencing their scores.                                                    |
| `sort`  | [Sort field/direction](https://solr.apache.org/guide/8_8/common-query-parameters.html#sort-parameter). The field on which to sort, followed by a space and direction (`desc` or `asc`). You can specify multiple sort fields like this: `sort=title asc,year desc`. |
| `rows`  | [Max results per page](https://solr.apache.org/guide/8_8/common-query-parameters.html#rows-parameter)]. This sets the "page size" for paginated search results.                                                                                                     |
| `start` | [Pagination offset](https://solr.apache.org/guide/8_8/common-query-parameters.html#start-parameter). The number of results to skip, for pagination purposes.                                                                                                        |
| `fl`    | [Field List](https://solr.apache.org/guide/8_8/common-query-parameters.html#fl-field-list-parameter). The list of fields to return in the query results.                                                                                                            |
| `wt`    | [Response writer](https://solr.apache.org/guide/8_8/common-query-parameters.html#wt-parameter). Select the response format by specifying one of [Solr’s response writers](http://wiki.apache.org/solr/QueryResponseWriter#List_of_Writers_Available).               |

**See also the [Solr facet parameters documentation](https://solr.apache.org/guide/6_6/faceting.html#Faceting-GeneralParameters).**

## Query examples

1. Search only the `title` field in the "docs" collection for the term "solr", and format the results as JSON:

```sh wrap  theme={"dark"}
http://FUSION_HOST:FUSION_PORT/api/query-pipelines/default/collections/docs/select?q=solr&fl=title&wt=json
```

2. Use the following query with wildcards and character escaping in the Query Workbench to search for both `BLU RAY MOVIES` and `CAMERA` classes in the `VIDEO/CD` and `PHOTO/CAMERA` departments:

   * `class_s:*RA* AND department_s:*O\/C*`

3. Use a movie collection to select the movie ID and rating where the rating is equal to 4.

```sh wrap  theme={"dark"}
http://FUSION_HOST:FUSION_PORT/api/query-pipelines/default/collections/docs/select?q=*:*&fl=movie_id,rating&fq=rating:4
```

4. Search for movies with "black" in the title, starting at the 20th result for pagination, then return the results as XML:

```sh wrap  theme={"dark"}
http://FUSION_HOST:FUSION_PORT/api/query-pipelines/default/collections/docs/select?q=black&fl=title&start=20&rows=20&wt=xml
```
