Skip to content

Commit 90ff957

Browse files
os-muskclaude
andauthored
docs(objectql): the ADR-0061 $search expansion over source columns is $icontains, and the __search reader is expandSearchToFilter (#14594)
Two independent comment-only corrections in `packages/objectql/src/search-companion.ts`, zero behaviour: 1. The module docblock opened "`$search` (ADR-0061 Tier 1) is a `$contains` over source columns". Source-column clauses compile to `$icontains` (`search-filter.ts:109` / `:111`), adjudicated at `search-filter.ts:23`: "[#7641] The case-insensitive operator is `$icontains`, NOT `$contains`." Operator spelling only — the argument the sentence carries survives the correction unchanged (case folding does not transliterate, so `zhangwei` cannot hit a stored CJK original under either operator). 2. `provisionSearchCompanion`'s docblock named the companion column's only reader `buildSearchFilter`, which is not an export of `search-filter.ts`. The reader is `expandSearchToFilter`. The two remaining `$contains` in this file (`:237`, `:286`) describe the hidden `__search` companion clause, where the case-SENSITIVE operator is correct and deliberate (`search-filter.ts:137-143`, "Do not 'align' the two"). Untouched. Claude-Session: https://claude.ai/code/session_0112hMx9hjJ9BgB28X97DS68 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7642aac commit 90ff957

2 files changed

Lines changed: 40 additions & 2 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
'@objectstack/objectql': patch
3+
---
4+
5+
docs(objectql): `search-companion.ts` — the ADR-0061 `$search` expansion over source columns is `$icontains`, and the companion column's reader is `expandSearchToFilter` (#13984)
6+
7+
Comment-only, zero behaviour. Two independent corrections in one file, listed
8+
separately because they are distinct claims:
9+
10+
1. The module docblock opened with "`$search` (ADR-0061 Tier 1) is a `$contains`
11+
over source columns". The source-column clauses compile to `$icontains`:
12+
`fieldClausesForTerm` returns `{ [field]: { $icontains: term } }`
13+
(`search-filter.ts:109` / `:111`), and the adjudication is recorded in that
14+
file's own header at `:23` — "[#7641] The case-insensitive operator is
15+
`$icontains`, NOT `$contains`." Only the operator spelling changed. The
16+
argument the sentence carries is untouched and still holds: typing `zhangwei`
17+
cannot hit a stored `张伟` under EITHER operator, because case folding does not
18+
transliterate. That is why a false spelling survived inside a correct
19+
argument.
20+
2. `provisionSearchCompanion`'s docblock named the companion column's only
21+
reader `buildSearchFilter`. That is not an export of `search-filter.ts` — or
22+
of anything else in the repo. The reader is `expandSearchToFilter`, the name
23+
the same file already uses 50 lines above.
24+
25+
The two remaining `$contains` mentions in this file (`:237` and `:286`) describe
26+
the hidden `__search` companion clause, where the case-SENSITIVE operator is
27+
correct and deliberate: the column is a normalized blob already lowercase on
28+
both sides, so `$contains` over two folded values is exact. `search-filter.ts`
29+
says so in the imperative at `:137-143` — "Do not 'align' the two." A whole-file
30+
find-and-replace here would turn two correct sentences false. They stay.
31+
32+
Published rather than skipped because correction 2 reaches the shipped
33+
declarations: it sits inside the JSDoc of the exported `provisionSearchCompanion`,
34+
and the build emits it into `dist/util-*.d.ts` and `dist/util-*.d.mts` (measured,
35+
with a positive control on an exported symbol's own doc line). Correction 1 does
36+
not reach any declaration file — a floating module-level block followed by an
37+
`import` is dropped by the declaration emitter — so on its own it would have been
38+
a `skip-changeset` diff.

packages/objectql/src/search-companion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Search-normalization companion column (`__search`) — pinyin recall (#2486).
55
*
6-
* `$search` (ADR-0061 Tier 1) is a `$contains` over source columns, so typing
6+
* `$search` (ADR-0061 Tier 1) is a `$icontains` over source columns, so typing
77
* the full pinyin (`zhangwei`) or initials (`zw`) of a CJK name ("张伟") can
88
* never hit — the stored value is the CJK original. This module provides the
99
* additive fix: a single hidden companion column per object that stores
@@ -283,7 +283,7 @@ function isDdlManaged(schema: CompanionObjectMeta): boolean {
283283
* Unlike #6810 the index is NOT re-declared in the object's `indexes[]`, and
284284
* that is a measured difference rather than an omission. #6810's predicate is
285285
* `organization_id = ?` — equality, which a B-tree serves. This column's ONLY
286-
* reader is `buildSearchFilter`, which emits `{ __search: { $contains: term } }`
286+
* reader is `expandSearchToFilter`, which emits `{ __search: { $contains: term } }`
287287
* (`search-filter.ts`) — a leading-wildcard `LIKE '%term%'` that no B-tree can
288288
* answer, and `IndexSchema` spells nothing else (`name` / `fields` / `unique`;
289289
* no trigram/GIN method). Declaring one would buy write amplification on every

0 commit comments

Comments
 (0)