# Advanced Search Documentation

## Operator Basics

* Search operators help you combine keywords to create more specific searches.
  * `AND` - All conditions must be true
  * `OR` - any condition can be true
  * `NOT` - this condition must not be true

## Operators Rules

### AND Operator

* And operators narrow results

  **Example 1**

  * I want to find artworks where both makers are involved

  ```
  (Maker A AND Maker B)
  ```

  **Example 2**

  * I want to find artworks by Maker A that use both Medium A and Medium B

  ```
  (Maker A AND Medium A AND Medium B)
  ```

### Sequential OR operators - Same fields

* When targeting the same field, `OR` operators combine to broaden search results\
  **Example 1**

  * I want to find artworks created by Maker A, Maker B, or Maker C.

  ```
  (Maker A OR Maker B OR Maker C)
  ```

  **Example 2**

  * I want to find artworks by Maker A that are either Medium A or Medium B

  ```
  (Maker A AND (Medium A OR Medium B))
  ```

### Sequential OR operators - Different fields

* When using OR operators with different field types, each query is automatically grouped separately

  **Example 1**

  * I want to find artworks by Maker A and anything that is Medium A

  ```
  (Maker A) OR (Medium A)
  ```

  **Example 2**

  * I want to find artworks by Maker A, Maker B, or Medium A
    * In this example, Maker A and Maker B are grouped together since they query the same field type.

  ```
  (Maker A OR Maker B) OR (Medium A)
  ```

### Nested Rules - Connection OR, AND, and NOT

* `AND` lets you combine and refine queries together with `OR` and `NOT` operators. All previously mentioned rules can be combined with AND operators.

  **Example 1:**

  * I want to find artworks by Maker A that are either Medium A or Medium B.

  ```
  (Maker A AND (Medium A OR Medium B))
  ```

  **Example 2**

  * I want to find artworks by Maker A that use either Medium A or Medium B, and all must have Title A.

  ```
  ((Maker A AND (Medium A OR Medium B)) AND Title A)
  ```
* Color-coded brackets illustrate nested operator levels

  ```
  ((Maker A AND (Medium A OR Medium B)) AND Title A)
  ```

### Query Groups with OR operators

* When using multiple OR operators with different fields, the query automatically splits into separate query groups.

  **Example 1**

  * I want artworks by Maker A that use either Medium A or Medium B, plus any artworks by Maker B.

  ```
  (Maker A AND (Medium A OR Medium B)) OR (Maker B)
  ```

  **Example 2**

  * I want artworks by Maker A that use either Medium A or Medium B, plus all artworks by Maker B except those using Medium A.

  ```
  (Maker A AND (Medium A OR Medium B)) OR (Maker B NOT Medium A)
  ```


---

# 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:

```
GET https://princeton-university-art-museu-1.gitbook.io/collection-search-help-docs/advanced-search-documentation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
