Query syntax¶
Curio uses one query language across the desktop search box, filter bar chips, smart folders, plugin filters, item.query, item.count, query.validate, query.facets and MCP item_query. Every query compiles directly to parameterized SQL, so nothing is filtered in memory.
model = "Anima" AND steps <= 12 AND cfg = 1
prompt CONTAINS "blue hair" AND lora = detail WITH lora_strength >= 0.7
(tag = cat OR tag = dog) AND rating >= 4 AND NOT ext = gif
shape = portrait AND width >= 2000 AND added WITHIN 30d
favorite = true AND explicit = false
tags HAS ALL (sky, sea) AND folder IN ("Concept art", References)
color ~ #3366ff/75 AND NEAR(52.23, 21.01, 10)
Grammar¶
expr := and (OR and)*
and := unary ([AND] unary)* (* juxtaposition implies AND *)
unary := NOT unary | '-' unary | primary
primary := '(' expr ')' | comparison (WITH comparison)* | place | word | "quoted text"
place := NEAR(lat, lon, km) | INSIDE(south, west, north, east)
comparison := field op value
| field ':' [op] value (* shorthand *)
| field IS [NOT] EMPTY
| field [NOT] IN (v, v, ...)
| field BETWEEN v AND v
| field HAS [ALL|NONE|ANY] (v, ...)
| field WITHIN duration
Text search¶
Bare words (sunset) and double-quoted phrases ("blue sky") query Curio's SQLite FTS5 full-text index using prefix matching.
- Indexed columns: Matches item name, notes (
annotation), source URL, tag names and indexed custom fields of typetext,single_select,multi_selectandurl. - Desktop vs API scope: In the desktop search box, the field-scope menu limits which columns plain text searches. In API calls such as
item.query, plain text always searches every indexed text column.
Fields¶
- Built-in fields: Refer to any built-in field by its canonical name or alias (case-insensitive). See Query fields.
- Custom and plugin fields: Refer to any custom field by its
keyor by its label with spaces and hyphens replaced by underscores (LoRA strength->lora_strength). - Name collisions: Built-in names take precedence over custom keys. Prefix colliding custom fields with
field.<key>(for examplefield.size). - Colon shorthand:
tag:sky,ext:png,rating:>=4,steps:<=12andwidth:>2000work as shorthand for=,>=,<=and>.
Boolean logic¶
- Precedence (highest to lowest): Parentheses
( ... ), thenNOTor unary-, thenAND(or whitespace juxtaposition), thenOR. - Implicit AND:
tag = sky rating >= 4meanstag = sky AND rating >= 4. - Unary minus:
-draft,-"work in progress"and-tag:wipnegate the following term or comparison.
Comparisons¶
| Operator | Applies to | Semantics |
|---|---|---|
=, != |
All types | Case-insensitive match for text; numeric equality with float tolerance on custom floats. On custom fields, != also matches items with no value. |
<, <=, >, >= |
Numbers, sizes, durations, dates, ratings | Numeric or chronological comparison. |
BETWEEN a AND b |
Numbers, sizes, durations, dates | Inclusive range (>= a AND <= b). |
IS EMPTY, IS NOT EMPTY |
Text, tags, folders, folder_color, part, custom fields |
Matches missing or empty values (model IS EMPTY, annotation IS NOT EMPTY). |
String ops¶
CONTAINS,NOT CONTAINS,STARTS WITH,ENDS WITH: Case-insensitive substring checks on text fields (prompt CONTAINS "watercolor",url STARTS WITH "https://github.com").MATCHES "regex": Case-insensitive regular expression match (name MATCHES "^IMG_\\d{4}"). Invalid regexes fail validation.
List ops¶
IN (v1, v2, ...)/NOT IN (v1, v2, ...): Matches when the field equals (or does not equal) any value in the non-empty list (ext IN (png, webp, avif)). An emptyIN ()is a syntax error.HAS ANY/HAS ALL/HAS NONE: Multi-value set operators fortags,foldersandmulti_selectcustom fields.tags HAS ALL (sky, sea)requires both tags;tags HAS NONE (draft, wip)excludes items carrying either tag.
Paired WITH¶
WITH joins two or more comparisons on paired multi-value custom fields so every clause matches the same list entry:
Without WITH, lora = "detail_tweaker" AND lora_strength >= 0.5 would match an item using detail_tweaker at 0.2 alongside another LoRA at 0.8.
Each clause after WITH must be a single-value predicate (=, !=, <, <=, >, >=, BETWEEN, CONTAINS, IN and similar), never IS EMPTY or HAS. When the word with is not followed by a field condition, Curio treats it as a plain search word.
Dates¶
Date fields (added, modified, created, edited and custom date or datetime fields) support:
- Aliases:
BEFORE(<),AFTER(>) andON(=). - Literals:
YYYY-MM-DD(2026-11-24),YYYY-MM-DD HH:MM,YYYY-MM(whole month),YYYY(whole year),todayandyesterday. - Whole-period semantics:
added = 2026spans all of 2026;added <= 2026-05includes all of May 2026;added = 2026-11-24covers the entire calendar day. - Relative durations: Units
s,m,h,d(days),w(weeks) andy(years) resolve to a cutoff timestamp in the past (now - duration): added WITHIN 30dandadded > 7d(oradded AFTER 7d) match newer items from within the last 30 or 7 days.added < 30d(oradded BEFORE 30d) matches older items from more than 30 days ago.
Units¶
- File sizes:
kb,mb,gb,tb(case-insensitive) or raw bytes (size >= 5mb,size BETWEEN 100kb AND 2mb). - Durations:
ms,s,m,h(duration <= 2m,duration >= 30s). - Aspect ratios (
aspect): Decimals or fractions (aspect = 16/9,aspect >= 1.5). Equality uses a ±0.015 tolerance matching the Filter bar's 4:3 and 16:9 chips, and excludes items with unknown dimensions. - Shapes (
shape):landscape,portrait,square,wide(panorama >= 2.35:1) andtall(vertical panorama <= 1:2.35).
Colors¶
| Expression | Meaning |
|---|---|
color ~ #3366ff |
Similar: At least one palette swatch covers >= 4% of the image within ΔE2000 <= 16 (or exact hex match). |
color = #3366ff |
Accurate: Within ΔE2000 <= 8 (>= 4% coverage). |
color ~ #3366ff/75 |
Custom accuracy (0 to 100): Interpolates the ΔE2000 threshold from 28 (accuracy 0) down to 4 (accuracy 100); 50 matches default ~. |
color = red |
Named presets (red, orange, yellow, green, cyan, blue, purple, pink, black, white, brown). |
color = grayscale |
Every palette swatch covering >= 0.5% has CIELAB chroma below 6. |
Geography¶
Two spatial functions query gps_lat and gps_lon populated by the built-in Camera EXIF reader:
NEAR(lat, lon, km): Matches items photographed withinkmkilometers of(lat, lon). Uses a local planar approximation accurate within a fraction of a percent up to several hundred kilometers. Example:NEAR(52.23, 21.01, 10).INSIDE(south, west, north, east): Matches items inside a latitude/longitude bounding box. Whenwest > east, the longitude span wraps across the 180° antimeridian. Example:INSIDE(49, 14, 55, 24).- Items without GPS: Items lacking GPS coordinates never match
NEAR(...)orINSIDE(...), so they matchNOT NEAR(...).
Nulls & errors¶
- Disabled file-reading fields: Querying a disabled file-reading field (such as
vae = xin Settings › Fields) fails withField '<key>' isn't indexed (Settings › Fields). Curio never silently returns zero items. - Validation: Call
query.validatebefore saving or running untrusted queries to check syntax errors and match counts.