Skip to content

Commit b486637

Browse files
committed
docs(spec): describe field.searchable as the auto-branch opt-in; changeset and liveness row
Claude-Session: https://claude.ai/code/session_01ADHkmSR2TvJTmoYyVtcQv9 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6eb560a commit b486637

8 files changed

Lines changed: 32 additions & 9 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/metadata-protocol': minor
4+
'@objectstack/lint': minor
5+
---
6+
7+
feat(spec): a field marked `searchable: true` is searched when its object declares no `searchableFields`
8+
9+
Clause-②: yes (widening)
10+
Metadata-protocol: semantic
11+
12+
`FieldSchema.searchable` was declared, defaulted and served, and nothing read it: `$search` skipped a field marked `searchable: true`, and a `$searchFields` override naming it was refused `400 INVALID_FIELD` "is not searchable" while the object's served schema said `searchable: true`. It is now honoured (ruling record 6573569376, letter A).
13+
14+
- **Before.** With no `searchableFields` declared, the search set was the type-based auto-default only: the text-like and `select` columns. A `code`, `html`, `lookup` or `json` field marked `searchable: true` was not scanned, and naming it in `$searchFields` answered 400.
15+
- **Now.** With no `searchableFields` declared, the set is the type-based auto-default plus every field marked `searchable: true`, of any type except `secret`, `password` and `vector`, which stay excluded (a virtual `formula` field has no stored column and stays out too). The `$searchFields` ingress allow-list is the same set, so naming a marked field narrows the search to it instead of answering 400. The flag is read before the auto-default's own exclusions, so a marked `hidden` field or a marked field named like a system column joins too.
16+
- **Unchanged.** A declared `searchableFields` is still the whole search set, and no field's own flag is read there. A field without the flag (or with `searchable: false`, the default) resolves exactly as before. A credential field is still never scanned.
17+
- **What may now match more.** A field you already marked `searchable: true` on an object without `searchableFields` is now part of `$search`. For a `lookup` that means its stored record id, not the related record's title. Remove the flag, or declare `searchableFields` to pin the set.
18+
- **New export.** `SEARCH_FLAG_EXCLUDED_TYPES` (`@objectstack/spec/data`) names the three hard exclusions. `SearchFieldMeta` gains the optional `searchable`.
19+
- **Messages.** The `$searchFields` refusal for a field outside the auto-default, and the `searchable-field-unsearchable` lint verdict, now name the missing `searchable: true` and offer it as the fix, instead of calling the field's type unscannable.

‎content/docs/api/data-api.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Query records with filtering, sorting, selection, and pagination.
2323
| `top` | query | Max records to return. No default — omitting it returns all matching records. |
2424
| `skip` | query | Offset |
2525
| `expand` | query | Comma-separated list of relations to eager-load. Must name a reference field (`lookup` / `master_detail` / `user` / `tree`) — otherwise `400 INVALID_FIELD`. |
26-
| `search` | query | Full-text search term, scanned case-insensitively across the object's searchable fields (its declared `searchableFields`, or a text-like auto-default when none are declared). When that set is empty — no `searchableFields` entry names a stored field, and the auto-default finds none — a non-blank term is `400 INVALID_FIELD`, never every row. |
26+
| `search` | query | Full-text search term, scanned case-insensitively across the object's searchable fields (its declared `searchableFields`, or, when none are declared, a text-like auto-default plus every field marked `searchable: true` except `secret` / `password` / `vector`). When that set is empty — no `searchableFields` entry names a stored field, and the auto-default finds none — a non-blank term is `400 INVALID_FIELD`, never every row. |
2727
| `searchFields` | query | Comma-separated subset of the searchable fields for `search` to scan — narrows the scan, never widens it. A name outside the searchable set is `400 INVALID_FIELD`. |
2828

2929
> **Note:** OData-style `$`-prefixed parameters (`$filter`, `$select`, `$orderby`, `$top`, `$skip`, `$expand`, `$count`, `$search`) are also accepted directly on this same endpoint as aliases — they're normalized internally to the parameter names above. There is no separate standalone OData endpoint.

‎content/docs/data-modeling/field-types.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ These properties are available on **all** field types:
10231023
| `required` | `boolean` | `false` | Whether the field is required |
10241024
| `unique` | `boolean \| 'global' \| 'organization'` | `false` (`'organization'` on `autonumber`) | Unique constraint **and its scope** (ADR-0120). `'organization'` = one holder per organization; `true` = that same per-organization scope (positional synonym — prefer the explicit spelling in new code); `'global'` = one holder across the whole installation; `false` = no constraint. Omitted ⇒ `false`, except on an `autonumber` field, where omitted ⇒ `'organization'` — an auto-number is a business identifier, so the platform makes it unique per organization by default; write `unique: false` explicitly to opt out. `'tenant'`/`'org'` are rejected — the word is `'organization'`. Full rule in the `unique` doc block in [`FieldSchema`](/docs/references/data/field) |
10251025
| `multiple` | `boolean` | `false` | Allow array of values (multi-record lookup, multi-select, multi-file). An emptied multi-value lookup reads back as `[]`, never `null` — the `multiple` doc block in [`FieldSchema`](/docs/references/data/field) |
1026-
| `searchable` | `boolean` | `false` | Include in search index |
1026+
| `searchable` | `boolean` | `false` | Search this field when the object declares no `searchableFields` — any type but `secret` / `password` / `vector`; a declared `searchableFields` is the whole set |
10271027
| `sortable` | `boolean` | `true` | Allow sorting by this field |
10281028
| `hidden` | `boolean` | `false` | Hide from default views |
10291029
| `readonly` | `boolean` | `false` | Server contract — non-system writes to this field are stripped on **both** INSERT and UPDATE (the value falls back to `defaultValue`), not just hidden in the UI (#2948 / #3043) |

‎content/docs/data-modeling/fields.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ These properties are available on all field types:
446446
447447
| Property | Type | Default | Description |
448448
| :--- | :--- | :--- | :--- |
449-
| `searchable` | `boolean` | `false` | Include in full-text search |
449+
| `searchable` | `boolean` | `false` | Search this field when the object declares no `searchableFields` — any type but `secret` / `password` / `vector`; a declared `searchableFields` is the whole set |
450450
| `externalId` | `boolean` | `false` | Not read: nothing matches on it. A seed dataset names its match field in its own `externalId`, an import in its mapping's `upsertKey` |
451451
452452
Database indexes are declared at the object level in the object's `indexes[]` array — there is no per-field `index` flag. See [Indexing](/docs/data-modeling/indexing).

‎content/docs/data-modeling/queries.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@ Only `query` and `fields` are implemented. The engine expands `search` into a dr
538538
<Callout type="info">
539539
`fields` (and its query-parameter spelling, `?searchFields=` / `?$searchFields=`) can only
540540
**narrow** the scan within the server-resolved searchable set — the object's declared
541-
`searchableFields`, or a text-like auto-default when none are declared. Over the
541+
`searchableFields`, or, when none are declared, a text-like auto-default plus every
542+
field marked `searchable: true` except `secret` / `password` / `vector`. Over the
542543
REST/protocol ingress a name outside that set is `400 INVALID_FIELD`, with distinct
543544
messages for a field that does not exist and a real field that is not searchable. An
544545
override that names no field at all (`?$searchFields=`, `?$searchFields=,`, an empty

‎content/docs/data-modeling/schema-design.mdx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ enable: {
8787
### Global search — `searchable` + `searchableFields`
8888

8989
`searchable: true` includes an object's records in global search and the record
90-
picker. By default the search matches the name/title field plus short-text fields.
90+
picker. By default the search matches the name/title field plus short-text fields, and
91+
every field marked `searchable: true` (any type but `secret` / `password` / `vector`).
9192
To control exactly which fields are matched, set `searchableFields` on the object
9293
(ADR-0061):
9394

@@ -102,7 +103,8 @@ To control exactly which fields are matched, set `searchableFields` on the objec
102103
Queries then pass a top-level `$search` parameter to match across `searchableFields`
103104
(e.g. `{ $search: 'acme' }`); a request may narrow the set with
104105
`$searchFields`. When `searchableFields` is unset, search falls back to the
105-
name/title field plus short-text fields. When neither leaves a stored field to scan — a
106+
name/title field plus short-text fields and the fields marked `searchable: true`; a
107+
declared `searchableFields` is the whole set, and no field's own flag is read. When neither leaves a stored field to scan — a
106108
junction object of lookups with a `formula` title, say — a list search is refused
107109
`400 INVALID_FIELD` rather than answered with every row, and global search skips the
108110
object; mirror the title onto a stored text field, as below.

‎content/docs/protocol/objectql/query-syntax.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,8 @@ const structured: QueryAST = {
11861186
Field resolution is server-side and never client-trusted: the requested fields
11871187
(`searchFields`, or `search.fields` in the structured form) are **intersected** with the
11881188
object's declared `searchableFields` (or, absent those, an auto-default of the name field
1189-
plus short-text/enum fields), so naming a field outside that set can never widen the
1189+
plus short-text/enum fields and every field marked `searchable: true` except `secret` /
1190+
`password` / `vector`), so naming a field outside that set can never widen the
11901191
search — and over the REST/protocol ingress it is `400 INVALID_FIELD` outright (#4254),
11911192
because the engine-side intersection alone used to drop the unknown name and fall back to
11921193
scanning the full searchable set. Internal callers reaching `engine.find()` directly keep

‎packages/spec/liveness/field.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@
407407
},
408408
"searchable": {
409409
"status": "live",
410-
"evidence": "ui/packages/plugin-dashboard/src/WidgetConfigPanel.tsx (:458 in objectui, commit not pinned)",
411-
"note": "LIVE via objectui renderer — the 2026-06 audit mis-classified as dead (renderer side not re-verified). Corrected after checking ../objectui."
410+
"evidence": "packages/spec/src/data/search-fields.ts (admittedBySearchableFlag, the auto branch of resolveSearchFieldResolution); read by packages/objectql/src/search-filter.ts (the search expansion), packages/metadata-protocol/src/protocol-query-validation.ts (the $searchFields ingress allow-list) and packages/lint/src/validate-searchable-fields.ts",
411+
"note": "Honoured since #29008 (ruling record 6573569376, letter A): with no object searchableFields, a field marked searchable: true joins the search set whatever its type, except secret / password / vector and a virtual formula field; a declared searchableFields stays the whole set and the flag is not read there. The row's earlier evidence, ui/packages/plugin-dashboard/src/WidgetConfigPanel.tsx, reads a dashboard WIDGET's searchable option, not this field key: before #29008 nothing read FieldSchema.searchable, as the card measured."
412412
},
413413
"externalId": {
414414
"status": "dead",

0 commit comments

Comments
 (0)