query¶
Operations for checking Query language expressions and computing rating, shape, kind, extension and animation facet distributions. Both operations target a library.
query.validate¶
Compile a query string against the library's active field catalog and return either its match count or a structured parse/indexing error (always HTTP 200, never failing with 400 on invalid syntax).
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string |
No | "" |
Query expression to validate. |
scope |
string |
No | "all" |
all, uncategorized, untagged, recent, trash or missing. |
library |
string |
No | Default library | Target library (ID, path or unique name). Not allowed for plugin callers. |
Returns { valid: true; count: number } | { valid: false; error: string }.
Example request
Example response
When invalid:
Events and errors Read-only. Returns 400 bad_request for an unknown scope, 403 not_allowed without metadata.read, 404 unknown_library or 409 library_closed / library_offline.
query.facets¶
Compute facet histograms (star ratings, shapes, kinds, extensions, animated counts and total) over items matching an optional query and scope. For distinct values of a single custom or reader field see field.facets; for item counts and byte totals by kind, extension, folder, tag or month see library.stats.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string |
No | "" |
Query string narrowing the facet population. |
scope |
string |
No | "all" |
all, uncategorized, untagged, recent, trash or missing. |
library |
string |
No | Default library | Target library (ID, path or unique name). Not allowed for plugin callers. |
Returns Facets.
Example request
Example response
{
"rating": { "0": 12, "4": 18, "5": 9 },
"shape": { "landscape": 24, "portrait": 11, "square": 4, "wide": 2, "tall": 0, "4:3": 3, "16:9": 15 },
"kinds": { "image": 37, "video": 2 },
"exts": { "png": 29, "jpg": 8, "mp4": 2 },
"animatedExts": { "webp": 1 },
"animated": 1,
"total": 39
}
Events and errors Read-only. Returns 400 bad_request on invalid query syntax or unknown scope, 403 not_allowed without metadata.read, 404 unknown_library or 409 library_closed / library_offline.