@lde/search 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -18
- package/dist/adapter.d.ts +1 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/project.d.ts +8 -7
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +21 -9
- package/dist/schema.d.ts +27 -11
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,8 +58,7 @@ a typed, deterministic function – easy to test, and swappable per deployment.
|
|
|
58
58
|
Exports are stratified by audience:
|
|
59
59
|
|
|
60
60
|
- **`@lde/search`** – the authoring surface: `defineSearchType`,
|
|
61
|
-
`searchSchema`, `projectRoots
|
|
62
|
-
validation, and every model/query/result type.
|
|
61
|
+
`searchSchema`, `projectRoots`, validation, and every model/query/result type.
|
|
63
62
|
- **`@lde/search/adapter`** – plumbing for engine adapters and API surfaces:
|
|
64
63
|
`physicalFields`, the field selectors, `assertValidQuery`, the filter
|
|
65
64
|
operators and storage codecs.
|
|
@@ -101,20 +100,19 @@ Two conventions hold across the whole family:
|
|
|
101
100
|
## Field model
|
|
102
101
|
|
|
103
102
|
The mapping is data, not code. Each field declares its `kind`, the IR `path` to
|
|
104
|
-
read (or a `derive` function for a **derived** field, computed from the
|
|
105
|
-
|
|
106
|
-
capabilities it opts into.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
read (or a `derive` function for a **derived** field, computed from the document
|
|
104
|
+
in declaration order – so it may read fields declared before it, never the
|
|
105
|
+
graph), and the capabilities (**roles**) it opts into. `path` is therefore the
|
|
106
|
+
complete statement of what the projection reads from the graph. A field that
|
|
107
|
+
declares **no** role is an **internal field**: projected so a later `derive` can
|
|
108
|
+
read it, then pruned before the writer and absent from the collection definition
|
|
109
|
+
– not stored, not indexed, no RAM. The physical field names a declaration fans
|
|
110
|
+
out to (per-locale search/sort keys) come from `physicalFields`, the single
|
|
111
|
+
convention projection, the collection definition and the query compiler all
|
|
112
|
+
share.
|
|
110
113
|
|
|
111
114
|
```ts
|
|
112
|
-
import {
|
|
113
|
-
defineSearchType,
|
|
114
|
-
projectRoots,
|
|
115
|
-
irisOf,
|
|
116
|
-
searchSchema,
|
|
117
|
-
} from '@lde/search';
|
|
115
|
+
import { defineSearchType, projectRoots, searchSchema } from '@lde/search';
|
|
118
116
|
|
|
119
117
|
const DATASET = defineSearchType({
|
|
120
118
|
name: 'Dataset', // logical API name: names the GraphQL type, a REST path, …
|
|
@@ -141,12 +139,17 @@ const DATASET = defineSearchType({
|
|
|
141
139
|
},
|
|
142
140
|
// → size (int)
|
|
143
141
|
{ name: 'size', path: 'urn:dr:size', kind: 'integer', sortable: true },
|
|
144
|
-
//
|
|
142
|
+
// internal field (no role): projected as a reading device for the derive
|
|
143
|
+
// below, then pruned before the writer – absent from the collection too
|
|
144
|
+
{ name: 'classes', path: 'urn:dr:class', kind: 'reference' },
|
|
145
|
+
// derived field (no path): computed from the document in declaration order,
|
|
146
|
+
// never from the graph – so `path` stays the whole statement of what is read
|
|
145
147
|
{
|
|
146
148
|
name: 'classCount',
|
|
147
149
|
kind: 'integer',
|
|
148
150
|
sortable: true,
|
|
149
|
-
derive: (
|
|
151
|
+
derive: (document) =>
|
|
152
|
+
(document.classes as string[] | undefined)?.length ?? 0,
|
|
150
153
|
},
|
|
151
154
|
],
|
|
152
155
|
});
|
|
@@ -225,8 +228,9 @@ each root’s subgraph is framed one at a time and its document yielded as
|
|
|
225
228
|
produced, so beyond a subject index memory stays flat at scale (framing the
|
|
226
229
|
whole graph at once is roughly O(N²)). Duplicate triples are collapsed first,
|
|
227
230
|
because some SPARQL engines (e.g. QLever) do not deduplicate `CONSTRUCT` output.
|
|
228
|
-
|
|
229
|
-
|
|
231
|
+
Every predicate a value comes from is read through a field’s `path`; a `derive`
|
|
232
|
+
computes only from the document projected so far, so `path` is the whole
|
|
233
|
+
statement of what the projection reads. `assertTypeInSchema` guards that
|
|
230
234
|
the passed `SearchType` is a member of the schema – the port’s own membership
|
|
231
235
|
check – so no schema is ever forged to scope a projection to one type.
|
|
232
236
|
|
package/dist/adapter.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* deployment author declaring a schema and running searches needs none of
|
|
7
7
|
* this; the main entry point carries that (small) authoring surface.
|
|
8
8
|
*/
|
|
9
|
-
export { assertTypeInSchema, physicalFields, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, referenceFields, fieldNamed, labelFieldOf, isRangeFacet, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
|
|
9
|
+
export { assertTypeInSchema, physicalFields, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, isInternalField, referenceFields, fieldNamed, labelFieldOf, isRangeFacet, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
|
|
10
10
|
export type { PhysicalFields } from './schema.js';
|
|
11
11
|
export { physicalNameTokens } from './physical-name.js';
|
|
12
12
|
export { filterOperatorFor, filterOperator, validateQuery, assertValidQuery, pageForOffset, } from './query.js';
|
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,eAAe,EACf,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/adapter.js
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* deployment author declaring a schema and running searches needs none of
|
|
7
7
|
* this; the main entry point carries that (small) authoring surface.
|
|
8
8
|
*/
|
|
9
|
-
export { assertTypeInSchema, physicalFields, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, referenceFields, fieldNamed, labelFieldOf, isRangeFacet, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
|
|
9
|
+
export { assertTypeInSchema, physicalFields, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, isInternalField, referenceFields, fieldNamed, labelFieldOf, isRangeFacet, isoToUnixSeconds, unixSecondsToIso, } from './schema.js';
|
|
10
10
|
export { physicalNameTokens } from './physical-name.js';
|
|
11
11
|
export { filterOperatorFor, filterOperator, validateQuery, assertValidQuery, pageForOffset, } from './query.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { projectRoots
|
|
1
|
+
export { projectRoots } from './project.js';
|
|
2
2
|
export type { SearchDocument } from './project.js';
|
|
3
3
|
export { defineSearchType, searchSchema, validateSearchType, assertValidSearchType, } from './schema.js';
|
|
4
4
|
export type { FieldKind, SearchField, SearchFieldBase, TextField, KeywordField, ReferenceField, NumericField, BooleanField, SearchType, SearchTypeIssue, SearchSchema, FacetRange, } from './schema.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAKnD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,SAAS,EACT,WAAW,EACX,eAAe,EACf,SAAS,EACT,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,eAAe,EACf,YAAY,EACZ,UAAU,GACX,MAAM,aAAa,CAAC;AAIrB,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAI5D,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,cAAc,EACd,WAAW,EACX,cAAc,EACd,SAAS,EACT,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
// under `@lde/search/adapter`; the engine-port conformance suite under
|
|
5
5
|
// `@lde/search/testing`.
|
|
6
6
|
// Projection: RDF CONSTRUCT quads → flat search documents, driven by the
|
|
7
|
-
// unified SearchField/SearchType model.
|
|
8
|
-
//
|
|
9
|
-
export { projectRoots
|
|
7
|
+
// unified SearchField/SearchType model. A `derive` reads the projected document,
|
|
8
|
+
// never the graph, so the IR readers stay internal to projection.
|
|
9
|
+
export { projectRoots } from './project.js';
|
|
10
10
|
// Unified field model: one declaration drives projection, engine collection
|
|
11
11
|
// schema, query semantics and the GraphQL surface – a discriminated union by
|
|
12
12
|
// `kind`, validated again at runtime when the schema is built.
|
package/dist/project.d.ts
CHANGED
|
@@ -8,10 +8,14 @@ export type SearchDocument = {
|
|
|
8
8
|
/**
|
|
9
9
|
* Project one framed JSON-LD node into a flat search document: apply each field
|
|
10
10
|
* of the type in declaration order. A field with a `derive` function computes
|
|
11
|
-
* its value from the
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* its value from the document as populated so far (so a derived field may read
|
|
12
|
+
* fields declared before it), never from the graph – `path` is the complete
|
|
13
|
+
* statement of what the projection reads. {@link isInternalField Internal
|
|
14
|
+
* fields} (those declaring no role) are populated so a later derive can read
|
|
15
|
+
* them, then pruned before the document is returned: they must reach neither a
|
|
16
|
+
* writer nor the collection definition. The physical field names a field fans
|
|
17
|
+
* out to come from {@link physicalFields}, the single source shared with the
|
|
18
|
+
* engine collection definition and the query compiler.
|
|
15
19
|
*/
|
|
16
20
|
export declare function projectDocument(node: FramedNode, searchType: SearchType): SearchDocument;
|
|
17
21
|
/**
|
|
@@ -28,7 +32,4 @@ export declare function projectDocument(node: FramedNode, searchType: SearchType
|
|
|
28
32
|
* array or a chained generator merging several readers.
|
|
29
33
|
*/
|
|
30
34
|
export declare function projectRoots(quads: Iterable<Quad>, roots: readonly string[], schema: SearchSchema, searchType: SearchType): AsyncIterable<SearchDocument>;
|
|
31
|
-
export declare function literalsOf(node: FramedNode, path: string): string[];
|
|
32
|
-
export declare function firstLiteralOf(node: FramedNode, path: string): string | undefined;
|
|
33
|
-
export declare function irisOf(node: FramedNode, path: string): string[];
|
|
34
35
|
//# sourceMappingURL=project.d.ts.map
|
package/dist/project.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EASL,KAAK,YAAY,EACjB,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AAErB,+DAA+D;AAC/D,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEtE;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,UAAU,GACrB,cAAc,CAoBhB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAuB,YAAY,CACjC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,EACrB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,aAAa,CAAC,cAAc,CAAC,CAU/B"}
|
package/dist/project.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { fold } from '@lde/text-normalization';
|
|
2
2
|
import { buildSubjectIndex, frameSubjects, } from './frame-by-type.js';
|
|
3
|
-
import { assertTypeInSchema, displayFieldName, isoToUnixSeconds, physicalFields, } from './schema.js';
|
|
3
|
+
import { assertTypeInSchema, displayFieldName, isInternalField, isoToUnixSeconds, physicalFields, } from './schema.js';
|
|
4
4
|
/**
|
|
5
5
|
* Project one framed JSON-LD node into a flat search document: apply each field
|
|
6
6
|
* of the type in declaration order. A field with a `derive` function computes
|
|
7
|
-
* its value from the
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* its value from the document as populated so far (so a derived field may read
|
|
8
|
+
* fields declared before it), never from the graph – `path` is the complete
|
|
9
|
+
* statement of what the projection reads. {@link isInternalField Internal
|
|
10
|
+
* fields} (those declaring no role) are populated so a later derive can read
|
|
11
|
+
* them, then pruned before the document is returned: they must reach neither a
|
|
12
|
+
* writer nor the collection definition. The physical field names a field fans
|
|
13
|
+
* out to come from {@link physicalFields}, the single source shared with the
|
|
14
|
+
* engine collection definition and the query compiler.
|
|
11
15
|
*/
|
|
12
16
|
export function projectDocument(node, searchType) {
|
|
13
17
|
const id = node['@id'];
|
|
@@ -18,6 +22,14 @@ export function projectDocument(node, searchType) {
|
|
|
18
22
|
for (const field of searchType.fields) {
|
|
19
23
|
applyField(document, node, field);
|
|
20
24
|
}
|
|
25
|
+
// Prune internal fields: they were projected only so the derives above could
|
|
26
|
+
// read them (a structural memo shared across every derive that needs the
|
|
27
|
+
// value), and must not reach the writer or the collection definition.
|
|
28
|
+
for (const field of searchType.fields) {
|
|
29
|
+
if (isInternalField(field)) {
|
|
30
|
+
delete document[field.name];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
21
33
|
return document;
|
|
22
34
|
}
|
|
23
35
|
/**
|
|
@@ -46,7 +58,7 @@ export async function* projectRoots(quads, roots, schema, searchType) {
|
|
|
46
58
|
}
|
|
47
59
|
function applyField(document, node, field) {
|
|
48
60
|
if (field.derive !== undefined) {
|
|
49
|
-
const value = field.derive(
|
|
61
|
+
const value = field.derive(document);
|
|
50
62
|
if (value !== undefined) {
|
|
51
63
|
document[field.name] = value;
|
|
52
64
|
}
|
|
@@ -146,15 +158,15 @@ function langValuesOf(node, path) {
|
|
|
146
158
|
.map(toLangValue)
|
|
147
159
|
.filter((value) => value !== undefined);
|
|
148
160
|
}
|
|
149
|
-
|
|
161
|
+
function literalsOf(node, path) {
|
|
150
162
|
return valuesOf(node, path)
|
|
151
163
|
.map(literalString)
|
|
152
164
|
.filter((value) => value !== undefined);
|
|
153
165
|
}
|
|
154
|
-
|
|
166
|
+
function firstLiteralOf(node, path) {
|
|
155
167
|
return literalsOf(node, path)[0];
|
|
156
168
|
}
|
|
157
|
-
|
|
169
|
+
function irisOf(node, path) {
|
|
158
170
|
return valuesOf(node, path)
|
|
159
171
|
.map(iriString)
|
|
160
172
|
.filter((value) => value !== undefined);
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { FramedNode } from './frame-by-type.js';
|
|
2
1
|
import type { SearchDocument } from './project.js';
|
|
3
2
|
/**
|
|
4
3
|
* The engine-neutral kind of a queryable field. It drives every downstream
|
|
@@ -32,9 +31,11 @@ export declare function filterOperatorFor(kind: FieldKind): FilterOperator | und
|
|
|
32
31
|
* Capability flags (`searchable`/`filterable`/`facetable`/`sortable`/`output`)
|
|
33
32
|
* are independent opt-ins: a field exposes exactly the roles it declares. A
|
|
34
33
|
* field with a {@link SearchFieldBase.derive `derive`} function instead of a
|
|
35
|
-
* `path` is a **derived field** – computed from the
|
|
36
|
-
*
|
|
37
|
-
* behavior (e.g. `status`, the compatibility booleans).
|
|
34
|
+
* `path` is a **derived field** – computed from the document projected so far
|
|
35
|
+
* rather than read from the graph – yet it still carries full query/schema/output
|
|
36
|
+
* behavior (e.g. `status`, the compatibility booleans). A field declaring **no**
|
|
37
|
+
* role at all is an {@link isInternalField **internal field**}: projected so a
|
|
38
|
+
* later derive can read it, then pruned before the writer.
|
|
38
39
|
*
|
|
39
40
|
* The physical field names a declaration fans out to (per-locale search/sort
|
|
40
41
|
* keys) follow one convention, owned by
|
|
@@ -73,15 +74,17 @@ export interface SearchFieldBase {
|
|
|
73
74
|
readonly sortable?: boolean;
|
|
74
75
|
/**
|
|
75
76
|
* Compute this field’s value instead of projecting it from a `path` – a
|
|
76
|
-
* status token, a compatibility boolean, a count over
|
|
77
|
+
* status token, a compatibility boolean, a count over an earlier field.
|
|
77
78
|
* Mutually exclusive with `path`. Runs in declaration order during
|
|
78
|
-
* projection, receiving
|
|
79
|
-
*
|
|
80
|
-
* `statusRank` reading the derived `status
|
|
81
|
-
*
|
|
82
|
-
*
|
|
79
|
+
* projection, receiving **only** the document as populated so far – never the
|
|
80
|
+
* graph – so a derived field reads fields declared before it (e.g. a
|
|
81
|
+
* `statusRank` reading the derived `status`, or a count reading an
|
|
82
|
+
* {@link isInternalField internal} field). Return `undefined` to leave the
|
|
83
|
+
* field absent. The field still carries full query/schema/output behaviour
|
|
84
|
+
* like any other. Reading only the document is what keeps `path` the complete
|
|
85
|
+
* statement of what the projection reads from the graph.
|
|
83
86
|
*/
|
|
84
|
-
readonly derive?: (
|
|
87
|
+
readonly derive?: (document: SearchDocument) => unknown;
|
|
85
88
|
}
|
|
86
89
|
/** Full-text inclusion with a `query_by` weight (folded; per-locale for
|
|
87
90
|
* localized text). Presence is what makes a field searchable. */
|
|
@@ -374,6 +377,19 @@ export declare function filterableFields(searchType: SearchType): readonly Searc
|
|
|
374
377
|
export declare function sortableFields(searchType: SearchType): readonly SearchField[];
|
|
375
378
|
/** Fields that appear in the API output type, in declaration order. */
|
|
376
379
|
export declare function outputFields(searchType: SearchType): readonly SearchField[];
|
|
380
|
+
/**
|
|
381
|
+
* Whether a field declares **no** role – none of `output`, `searchable`,
|
|
382
|
+
* `filterable`, `facetable`, `sortable`. Such a field is an **internal field**:
|
|
383
|
+
* the projection populates it (so a later {@link SearchFieldBase.derive} can
|
|
384
|
+
* read it), then prunes it before the document reaches a writer, and the engine
|
|
385
|
+
* collection definition omits it entirely – not stored, not indexed, no RAM.
|
|
386
|
+
* Absence of a role declares that intent; there is no separate marker flag.
|
|
387
|
+
*
|
|
388
|
+
* The single predicate the projection and the collection definition share, so
|
|
389
|
+
* they cannot disagree on what is internal. See the Search context’s load-bearing
|
|
390
|
+
* line: *a field without a Role is an Internal Field.*
|
|
391
|
+
*/
|
|
392
|
+
export declare function isInternalField(field: SearchField): boolean;
|
|
377
393
|
/** Fields of kind `reference` (IRI-valued, label-resolved), in declaration order. */
|
|
378
394
|
export declare function referenceFields(searchType: SearchType): readonly ReferenceField[];
|
|
379
395
|
/** Look up a field by its logical name. */
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,SAAS,GACT,SAAS,GACT,QAAQ,GACR,SAAS,GACT,MAAM,GACN,WAAW,CAAC;AAEhB;oEACoE;AACpE,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CAAC;AAcnD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,GAAG,SAAS,CAE7E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,WAAW,GACnB,SAAS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OH;AAED,8DAA8D;AAC9D,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,GACrB,SAAS,WAAW,EAAE,CAExB;AAED,sDAAsD;AACtD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,UAAU,GACrB,SAAS,WAAW,EAAE,CAExB;AAED,qEAAqE;AACrE,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,WAAW,EAAE,CAE7E;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,WAAW,EAAE,CAE3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAQ3D;AAED,qFAAqF;AACrF,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,GACrB,SAAS,cAAc,EAAE,CAE3B;AAED,2CAA2C;AAC3C,wBAAgB,UAAU,CACxB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,GACX,WAAW,GAAG,SAAS,CAEzB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,WAAW,GACjB,KAAK,IAAI,YAAY,GAAG;IAAE,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,CAEzE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGhE;AAED,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,cAAc,CAgBjE"}
|
package/dist/schema.js
CHANGED
|
@@ -317,6 +317,25 @@ export function sortableFields(searchType) {
|
|
|
317
317
|
export function outputFields(searchType) {
|
|
318
318
|
return searchType.fields.filter((field) => field.output === true);
|
|
319
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* Whether a field declares **no** role – none of `output`, `searchable`,
|
|
322
|
+
* `filterable`, `facetable`, `sortable`. Such a field is an **internal field**:
|
|
323
|
+
* the projection populates it (so a later {@link SearchFieldBase.derive} can
|
|
324
|
+
* read it), then prunes it before the document reaches a writer, and the engine
|
|
325
|
+
* collection definition omits it entirely – not stored, not indexed, no RAM.
|
|
326
|
+
* Absence of a role declares that intent; there is no separate marker flag.
|
|
327
|
+
*
|
|
328
|
+
* The single predicate the projection and the collection definition share, so
|
|
329
|
+
* they cannot disagree on what is internal. See the Search context’s load-bearing
|
|
330
|
+
* line: *a field without a Role is an Internal Field.*
|
|
331
|
+
*/
|
|
332
|
+
export function isInternalField(field) {
|
|
333
|
+
return (field.output !== true &&
|
|
334
|
+
field.searchable === undefined &&
|
|
335
|
+
field.filterable !== true &&
|
|
336
|
+
field.facetable !== true &&
|
|
337
|
+
field.sortable !== true);
|
|
338
|
+
}
|
|
320
339
|
/** Fields of kind `reference` (IRI-valued, label-resolved), in declaration order. */
|
|
321
340
|
export function referenceFields(searchType) {
|
|
322
341
|
return searchType.fields.filter((field) => field.kind === 'reference');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/search",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Engine- and domain-agnostic core for RDF-backed search: a unified declarative field model (SearchField/SearchType/SearchSchema), a neutral query IR, the SearchEngine port with logical result types, and a streaming CONSTRUCT-to-document projection. Bakes in no engine, protocol, or domain.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "git+https://github.com/ldelements/lde.git",
|