> For the complete documentation index, see [llms.txt](https://docs.pacificdata.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pacificdata.org/catalogue/advanced-search/solr-search.md).

# Solr Search Queries

By enabling the advanced search feature, you can take advantage of Solr's flexible search syntax to analyze your data. For example, you can search for data that contains the terms 'Climate' and 'Financing' in close proximity to each other, or search for data or dates that fall within a specific range.

{% hint style="info" %}
You can add Solr search queries by enabling 'Advanced search' under the search bar, then checking the 'Add query syntax to search' check box.
{% endhint %}

![Enbaling advanced search](/files/-Mc4UINscpX8RvB2mM-7)

![Enabling Solr search](/files/-Mc4UCdlH3Lz4bRE44yH)

### Searching for keywords and search phrases

The following are examples of searches for a specific keyword or search phrase.

| Task                                                                                                      | Example                                                                                                                                 | Syntax                                                                     |
| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| Search for a keyword in a specific field                                                                  | Search for the keyword `AccessLog` in the title field                                                                                   | `title:AccessLog`                                                          |
| Search for a phrase in a specific field                                                                   | Search for the phrase `Code 1918` in the title field                                                                                    | `title:"Code 1918"`                                                        |
| Search for a phrase in one field and a second phrase in another field                                     | Search for `Error 401` in the title field and `Authorization is denied` in the body field                                               | `title:"Error 401" AND body:"Authorization is denied"`                     |
| Combine searches for multiple phrases or keywords using operators such as AND or OR                       | Search for `Error 401` in the title field AND `Authorization is denied` in the body field, or search for `Password` in the title field. | `(title:"Error 401" AND body:"Authorization is denied") OR title:Password` |
| Search for a keyword in a specific field, excluding search results with another keyword in the same field | Search for `401` but not `404` in the title field                                                                                       | `title:401 -title:404`                                                     |
| Search for data in which a field does not contain a specific value                                        | Search for data where the inStock field is not false                                                                                    | `-inStock:false`                                                           |
| Search for values in a specified range                                                                    | Search for values from `20020101` to `20030101` in the mod\_date field                                                                  | `mod_date:[20020101 TO 20030101]`                                          |

### Searching using wildcards

You can use the wildcard character (\*) to search for results that are not exact matches. Solr search syntax does not support using a wildcard symbol as the first character of a search.

| Task                                                                                     | Example                                                                         | Syntax              |
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------- |
| Search for words starting with a string of characters                                    | Search for any word that starts with `En` in the title field                    | `title:En*`         |
| Search for words starting and ending with specific strings of characters                 | Search for any word that starts with `En` and ends with `ed` in the title field | `title:En*ed`       |
| Search for values in a field that are less than or equal to a specified numeric value    | Search for values in the code field that are less than or equal to 100          | `code:[* TO 100]`   |
| Search for values in a field that are greater than or equal to a specified numeric value | Search for values in the code field that are greater than or equal to 100       | `code:[100 TO *]`   |
| Search for data that contains a specific field                                           | Find data that includes the message field                                       | `message:[* TO *]`  |
| Search for data that does not contain a specific field                                   | Find data that does not have a message field                                    | `-message:[* TO *]` |

#### Searching using additional search options

You can search for terms that are a given number of words away from each other (called a proximity search).

| Task                                                                         | Example                                                  | Syntax             |
| ---------------------------------------------------------------------------- | -------------------------------------------------------- | ------------------ |
| Search for keywords that are a specific number of words away from each other | Search for `log analysis` within 4 words from each other | `"log analysis"~4` |
| Search for transposed words                                                  | Search for `log analysis` or `analysis log`              | `"log analysis"~1` |

You can approximate a search for multiple keywords (for example, a search for business AND analysis) using a search with a large proximity value, such as `"business analysis"~10000000`. For practical purposes, this returns the same group of results as searching for business AND analysis. Unlike a search for business AND analysis, however, results in which business and analysis are closer together are regarded as having a higher search relevance. However, the proximity search also requires more time and system resources to perform.

You can determine which parts of a search query are treated as more important by providing a numeric boost factor. For example, the following query assigns higher importance to matches in the title field than matches in the body field: `(title:MicroStrategy OR title:Analytics)^1.5 (body:Intelligence OR body:Server)`.

For a detailed overview of Solr query syntax, including information about creating queries that take advantage of functions, nested queries, boost factors, and more, see the [official documentation for the query parser syntax](http://lucene.apache.org/java/3_5_0/queryparsersyntax.html). In most cases, Solr uses the standard Lucene query syntax to perform searches. For a list of exceptions, see the [Solr wiki](http://wiki.apache.org/solr/SolrQuerySyntax).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.pacificdata.org/catalogue/advanced-search/solr-search.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
