# Search Query Syntax

The Duro search bar supports a structured `key:value` query syntax that lets you build precise filters by typing. Queries are parsed into filter pills that you can further refine visually.

{% hint style="info" %}
This page covers the **manual search syntax** (Normal mode). For AI-powered natural language search, toggle "AI Mode On" in the search bar and type freely. For the programmatic API, see [Searching and Filtering](/advanced-topics/searching-and-filtering.md).
{% endhint %}

## How It Works

1. Type a query like `type:part status:design` in the search bar
2. Press **Enter**
3. Your query is parsed into filter pills on the components page
4. Results update immediately

Multiple filters separated by spaces combine with **AND** logic. You can switch to **Any** (OR) mode using the toggle in the filter pill bar.

***

## Quick Reference

| Key          | Aliases       | Description          | Example                 |
| ------------ | ------------- | -------------------- | ----------------------- |
| `type`       |               | Component type       | `type:part`             |
| `status`     |               | Status name          | `status:design`         |
| `state`      |               | Released or modified | `state:released`        |
| `category`   |               | Category name        | `category:capacitor`    |
| `label`      | `labels`      | Label / tag name     | `labels:"Needs Review"` |
| `cpn`        |               | Part number (CPN)    | `cpn:212-00001`         |
| `name`       |               | Component name       | `name:"Mountain Bike"`  |
| `desc`       | `description` | Description text     | `desc:ceramic`          |
| `created`    | `createdAt`   | Creation date        | `created:>2025-01-01`   |
| `modified`   | `updatedAt`   | Last modified date   | `modified:>2025-01-01`  |
| `createdBy`  |               | Creator name         | `createdBy:dustin`      |
| `modifiedBy` |               | Last modifier name   | `modifiedBy:rachel`     |
| `rev`        | `revision`    | Revision value       | `rev:>A`                |
| `pinned`     |               | Pinned status        | `pinned:true`           |
| `bookmarked` |               | Bookmarked status    | `bookmarked:true`       |
| `attr:`      |               | Attribute value      | `attr:capacitance:>10`  |

Free text without a key prefix searches across name, CPN, and description simultaneously.

***

## Operators

| Syntax           | Meaning               | Example                          |
| ---------------- | --------------------- | -------------------------------- |
| `key:value`      | equals                | `status:design`                  |
| `key!:value`     | not equals            | `status!:design`                 |
| `key:val1,val2`  | any of (OR)           | `status:design,prototype`        |
| `key!:val1,val2` | none of               | `modifiedBy!:dustin,yuri`        |
| `key:>value`     | greater than / after  | `created:>2025-01-01`            |
| `key:<value`     | less than / before    | `rev:<C`                         |
| `key:>=value`    | greater than or equal | `attr:weight:>=100`              |
| `key:<=value`    | less than or equal    | `attr:capacitance:<=10`          |
| `key:val1..val2` | range (inclusive)     | `created:2025-01-01..2025-06-01` |

### Quoting

Use double quotes for values that contain spaces:

```
labels:"Needs Review"
name:"Mountain Bike Frame"
```

Commas and colons inside quotes are treated as literal characters:

```
labels:"A, B"        (one label named "A, B", not two labels)
name:"Part: Rev A"   (colon is part of the name)
```

***

## Keys in Detail

### type

Filter by component type. Values: `part`, `assembly`, `document`.

```
type:part
type:assembly
type:document
type:part,assembly       (parts OR assemblies)
```

### status

Filter by the component's custom status name. Uses the exact status names configured in your library.

```
status:design
status:production
status!:obsolete         (not in obsolete status)
status:design,prototype  (in design OR prototype)
```

### state

Filter by release state. Values: `released`, `modified`.

```
state:released
state:modified
```

### category

Filter by category name. Uses the exact category names configured in your library.

```
category:capacitor
category:resistor
category!:connector       (not connectors)
category:diode,transistor (diodes OR transistors)
```

### label / labels

Filter by label (tag) name. Uses the exact label names in your library.

```
label:urgent
labels:"Needs Review"
labels!:deprecated
```

### cpn

Filter by component part number (CPN). Matches the displayed CPN value.

```
cpn:212-00001
cpn:RES-001
```

### name

Filter by component name. Supports partial matching.

```
name:"Mountain Bike"
name:LM7805
```

### desc / description

Search within component descriptions. Uses full-text search with word stemming (e.g., "capacitor" matches "capacitors").

```
desc:ceramic
description:"high voltage"
desc!:obsolete            (description does not contain "obsolete")
```

### created / modified

Filter by creation or modification date. Supports comparison operators and ranges.

```
created:>2025-01-01           (created after Jan 1, 2025)
modified:<2025-06-01          (modified before Jun 1, 2025)
created:2025-01-01..2025-06-01  (created between Jan 1 and Jun 1)
modified:>2025-03-01          (modified after Mar 1, 2025)
```

### createdBy / modifiedBy

Filter by the user who created or last modified the component. Matches against user names in your library.

```
createdBy:dustin
modifiedBy:rachel
modifiedBy!:dustin,yuri   (not modified by dustin or yuri)
```

### rev / revision

Filter by revision value. Supports comparison operators for ordering.

```
rev:A
rev:>B           (revisions after B)
rev:<5           (revisions before 5)
rev:A..D         (revisions A through D)
```

### pinned / bookmarked

Filter by pin or bookmark status.

```
pinned:true
pinned:false
bookmarked:true
```

### attr: (Attributes)

Filter by user-defined attribute values. The `attr:` prefix is required to distinguish from built-in keys. Attribute names are matched case-insensitively against your library's configured attributes.

```
attr:capacitance:>10
attr:color:black
attr:weight:>=100
attr:material:steel
attr:cost:<50
```

{% hint style="info" %}
Attribute filters require the component to **have** the attribute. For example, `attr:color!:black` returns components that have a color attribute but where the value is not black. Components without a color attribute are excluded.
{% endhint %}

***

## Free Text Search

Any text without a `key:` prefix is treated as a free-text search across component name, CPN, and description.

```
mountain bike            (searches name, CPN, and description)
LM7805                   (finds by name or CPN match)
ceramic                  (finds in name or description)
```

Free text can be combined with key:value filters:

```
ceramic type:part        (free text "ceramic" AND type is part)
```

***

## Combining Filters

Multiple space-separated filters combine with **AND** logic:

```
type:part status:design modifiedBy:dustin created:>2025-01-01
```

This finds **parts** in **design** status, modified by **dustin**, created **after Jan 1, 2025** — all conditions must match.

After parsing, you can switch to **Any** (OR) mode using the All/Any toggle in the filter pill bar.

***

## Common Scenarios

### Find all parts in a specific status

```
type:part status:design
```

### Find components not modified by a specific user

```
modifiedBy!:john
```

### Find released resistors and capacitors

```
state:released category:resistor,capacitor
```

### Find components modified in the last quarter

```
modified:>2025-01-01
```

### Find components by date range

```
created:2025-01-01..2025-03-31
```

### Find components by description keyword

```
desc:automotive
```

### Find parts where an attribute exceeds a threshold

```
type:part attr:capacitance:>100
```

### Find components where color is not black

```
attr:color!:black
```

### Exclude multiple users from results

```
modifiedBy!:dustin,yuri
```

### Find components with a specific revision or higher

```
rev:>B type:part
```

### Find pinned favorites in production

```
pinned:true status:production
```

### Combine free text with structured filters

```
ceramic type:part status:design
```

***

## Error Handling

If a key is unrecognized, the search bar highlights the problematic segment and suggests a correction. For example:

* `weight:100` — suggests `attr:weight:100` (attribute prefix required)
* `foobar:xyz` — shows "Unknown key" error

Partially valid queries still work. If 3 of 4 segments parse successfully, the 3 valid filters are applied and the 1 error is shown.

***

## API Equivalent

The search bar syntax maps to the `buildFilterFromQuery` GraphQL query. API consumers can use this directly:

```graphql
query {
  component {
    buildFilterFromQuery(input: { query: "type:part status:design" }) {
      filterValues {
        field
        comparator
        value
        displayLabel
      }
      filterInput {
        and {
          status { id { eq } }
          category { type { eq } }
        }
      }
      success
      errors {
        segment
        message
        suggestion
      }
    }
  }
}
```

Or execute the search in one call:

```graphql
query {
  component {
    filterWithQuery(input: { query: "type:part status:design", limit: 50 }) {
      components {
        id
        name
      }
      totalCount
      pageInfo {
        hasNextPage
        endCursor
        resultsReturnedCount
      }
      interpretation
    }
  }
}
```

To paginate through results, pass the `endCursor` from the previous page as `after`:

```graphql
query {
  component {
    filterWithQuery(input: {
      query: "type:part status:design"
      limit: 50
      after: "eyJ2IjoiMjAyNi0wMy0yM1..."
    }) {
      components { id name }
      pageInfo { hasNextPage endCursor }
    }
  }
}
```

{% hint style="success" %}
The `filterWithQuery` API accepts the same syntax as the search bar, making it easy to build integrations that mirror the web app's search experience.
{% endhint %}

***

## Next Steps

* [Searching and Filtering API Reference](/advanced-topics/searching-and-filtering.md) — programmatic filtering with the Advanced Filter API and AI search
* [Components](/core-concepts/components.md) — component data model and CRUD operations
* [Authentication](/getting-started/authentication.md) — setting up API access


---

# Agent Instructions: 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://docs.durohub.com/advanced-topics/search-query-syntax.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.
