@lde/search 0.36.4 → 0.38.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/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, irAlias, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, isInternalField, isInlineReference, nestedReferenceType, nestedFieldName, localLookupTargetsOf, referencedTargetsOf, storedTargetOf, TARGET_FIELD, identityFieldOf, identityFieldName, inheritedFacetPolicies, referenceFields, referenceTypeNamed, endpointFieldOf, rootTypeNamed, inlineFramingDepth, fieldNamed, datasetField, ID_FIELD, AND_KEY, OR_KEY, labelFieldOf, labelFieldNameOf, labelSourceNamesOf, labelTargetNamesOf, documentKeyOf, DEFAULT_LABEL_FIELD, isRangeFacet, isBinnedRangeFacet, storedFacetRanges, isAbsoluteIri, isoToUnixSeconds, lastSecondOf, unixSecondsToIso, isDatePrecision, } from './schema.js';
9
+ export { assertTypeInSchema, physicalFields, irAlias, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, isInternalField, isInlineReference, nestedReferenceType, nestedFieldName, localLookupTargetsOf, referencedTargetsOf, storedTargetOf, TARGET_FIELD, identityFieldOf, identityFieldName, inheritedFacetPolicies, referenceFields, referenceTypeNamed, endpointFieldOf, rootTypeNamed, inlineFramingDepth, fieldNamed, datasetField, ID_FIELD, AND_KEY, OR_KEY, labelFieldOf, labelFieldNameOf, labelSourceNamesOf, labelTargetNamesOf, documentKeyOf, DEFAULT_LABEL_FIELD, isRangeFacet, isBinnedRangeFacet, storedFacetRanges, isAbsoluteIri, isoToUnixSeconds, storedRangeBound, lastSecondOf, unixSecondsToIso, isDatePrecision, } from './schema.js';
10
10
  export type { PhysicalFields, DatePrecision, StoredDate } from './schema.js';
11
11
  export { missingRequiredFields } from './project.js';
12
12
  export { physicalNameTokens } from './physical-name.js';
@@ -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,OAAO,EACP,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,WAAW,EACX,cAAc,EACd,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,WAAW,EACX,cAAc,EACd,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
package/dist/adapter.js 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, irAlias, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, isInternalField, isInlineReference, nestedReferenceType, nestedFieldName, localLookupTargetsOf, referencedTargetsOf, storedTargetOf, TARGET_FIELD, identityFieldOf, identityFieldName, inheritedFacetPolicies, referenceFields, referenceTypeNamed, endpointFieldOf, rootTypeNamed, inlineFramingDepth, fieldNamed, datasetField, ID_FIELD, AND_KEY, OR_KEY, labelFieldOf, labelFieldNameOf, labelSourceNamesOf, labelTargetNamesOf, documentKeyOf, DEFAULT_LABEL_FIELD, isRangeFacet, isBinnedRangeFacet, storedFacetRanges, isAbsoluteIri, isoToUnixSeconds, lastSecondOf, unixSecondsToIso, isDatePrecision, } from './schema.js';
9
+ export { assertTypeInSchema, physicalFields, irAlias, displayFieldName, displayFieldPattern, displayLangOf, searchableFields, facetableFields, filterableFields, sortableFields, outputFields, isInternalField, isInlineReference, nestedReferenceType, nestedFieldName, localLookupTargetsOf, referencedTargetsOf, storedTargetOf, TARGET_FIELD, identityFieldOf, identityFieldName, inheritedFacetPolicies, referenceFields, referenceTypeNamed, endpointFieldOf, rootTypeNamed, inlineFramingDepth, fieldNamed, datasetField, ID_FIELD, AND_KEY, OR_KEY, labelFieldOf, labelFieldNameOf, labelSourceNamesOf, labelTargetNamesOf, documentKeyOf, DEFAULT_LABEL_FIELD, isRangeFacet, isBinnedRangeFacet, storedFacetRanges, isAbsoluteIri, isoToUnixSeconds, storedRangeBound, lastSecondOf, unixSecondsToIso, isDatePrecision, } from './schema.js';
10
10
  export { missingRequiredFields } from './project.js';
11
11
  export { physicalNameTokens } from './physical-name.js';
12
12
  export { matchLanguage } from './language.js';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { projectRoots } from './project.js';
2
2
  export type { ProjectedNode, ProjectionContext, SearchDocument, } from './project.js';
3
3
  export { defineSearchType, searchSchema, validateSearchType, assertValidSearchType, ID_FIELD, AND_KEY, OR_KEY, isoToUnixSeconds, lastSecondOf, unixSecondsToIso, isDatePrecision, } from './schema.js';
4
- export type { FieldKind, SearchField, SearchFieldBase, TextField, KeywordField, ReferenceField, ReferenceStrategy, NumericField, NumberField, DateField, BooleanField, SearchType, SearchTypeBase, RootType, ReferenceType, RootTypeOf, SearchTypeIssue, KeyField, FacetKeys, SearchSchema, FacetRange, DateFacetRange, ProjectionValue, DatePrecision, StoredDate, } from './schema.js';
4
+ export type { FieldKind, SearchField, SearchFieldBase, TextField, KeywordField, ReferenceField, ReferenceStrategy, NumericField, NumberField, DateField, PeriodField, BooleanField, SearchType, SearchTypeBase, RootType, ReferenceType, RootTypeOf, SearchTypeIssue, KeyField, FacetKeys, SearchSchema, FacetRange, DateFacetRange, ProjectionValue, DatePrecision, StoredDate, } from './schema.js';
5
5
  export { joinGraph, MAX_JOIN_DEPTH } from './join-graph.js';
6
6
  export type { JoinGraph } from './join-graph.js';
7
7
  export { filterOn } from './query.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,cAAc,GACf,MAAM,cAAc,CAAC;AAKtB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,QAAQ,EACR,OAAO,EACP,MAAM,EAMN,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,SAAS,EACT,WAAW,EACX,eAAe,EACf,SAAS,EACT,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,SAAS,EACT,YAAY,EACZ,UAAU,EACV,cAAc,EACd,QAAQ,EACR,aAAa,EACb,UAAU,EACV,eAAe,EACf,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,GACX,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAOjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EACV,WAAW,EACX,mBAAmB,EACnB,MAAM,EACN,SAAS,EACT,aAAa,EACb,eAAe,EACf,IAAI,GACL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,cAAc,EACd,WAAW,EACX,cAAc,EACd,SAAS,EACT,cAAc,EACd,KAAK,EACL,WAAW,EACX,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,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cAAc,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The stretch of time a `period` value covers, as stored: the first and the
3
+ * last second it allows, both inclusive. An open or unknown bound is stored as
4
+ * {@link OPEN_START} or {@link OPEN_END}, so the overlap test an engine runs
5
+ * needs no special case for it.
6
+ */
7
+ export interface StoredPeriod {
8
+ readonly start: number;
9
+ readonly end: number;
10
+ }
11
+ /**
12
+ * The stored start of a period with no known beginning (`../1607`, `/1607`).
13
+ * An exact int64 further back than any year a source states – about 146
14
+ * billion years, ten times the age of the universe – so a period open at its
15
+ * start overlaps every range that reaches back far enough to meet its end.
16
+ * The codec reads years to ±2⁶³ seconds; a bound past ±2⁶² is not refused,
17
+ * just never a real one.
18
+ */
19
+ export declare const OPEN_START: number;
20
+ /** The stored end of a period with no known end (`1440/..`, `1440/`); the
21
+ * mirror of {@link OPEN_START}. */
22
+ export declare const OPEN_END: number;
23
+ /**
24
+ * The period one value covers, or `undefined` for a value that states none.
25
+ *
26
+ * A value is an [EDTF](https://www.loc.gov/standards/datetime/) Level 0 or 1
27
+ * date or interval, or anything the `date` codec reads ({@link
28
+ * isoToUnixSeconds}): an `xsd:date`, `xsd:gYear`, `xsd:dateTime` or a
29
+ * deep-time year. What each covers, from its first second to its last:
30
+ *
31
+ * | Value | Covers |
32
+ * | ----------------- | ------------------------------- |
33
+ * | `1935` | all of 1935 |
34
+ * | `1935/1955` | 1935 through 1955 |
35
+ * | `1620~`, `1620?` | all of 1620 – the qualifier is not a margin |
36
+ * | `162X` | 1620 through 1629 |
37
+ * | `1620-XX`, `1606-21` | all of 1620, all of 1606 – a season is its year |
38
+ * | `1440/..`, `1440/`| 1440 onwards, unbounded |
39
+ * | `../1607` | everything up to the end of 1607 |
40
+ *
41
+ * **An unknown bound reads as an open one.** EDTF tells them apart (`1440/` is
42
+ * an end nobody knows, `1440/..` one that has not come), but a range filter
43
+ * must answer for both, and leaving a work out of every result it might belong
44
+ * to costs a reader more than one extra hit.
45
+ *
46
+ * **Each side is read on its own**, through the `date` codec: an empty or `..`
47
+ * side is open, and what only EDTF states is rewritten into a form the codec
48
+ * reads – a qualifier dropped, an unspecified month or day dropped to the
49
+ * coarser precision, a season read as its year (EDTF fixes no months for it),
50
+ * unspecified year digits read as their lowest and highest. Anything else
51
+ * EDTF Level 1 does not allow, such as Level 2’s `1950S2`, states no period.
52
+ * A value open at both ends, or ending before it starts, is no period at all.
53
+ */
54
+ export declare function periodOf(value: string): StoredPeriod | undefined;
55
+ /**
56
+ * The period several periods cover between them: the earliest start and the
57
+ * latest end. One stored range per document is what an engine can sort on and
58
+ * compare in a single clause, so a work dated `1668`, `1676` and `1686` is
59
+ * stored as 1668 through 1686 – and a range falling between its dates still
60
+ * matches it.
61
+ */
62
+ export declare function periodCovering(first: StoredPeriod, ...rest: readonly StoredPeriod[]): StoredPeriod;
63
+ //# sourceMappingURL=period.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"period.d.ts","sourceRoot":"","sources":["../src/period.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,QAAa,CAAC;AAErC;oCACoC;AACpC,eAAO,MAAM,QAAQ,QAAU,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAehE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EACnB,GAAG,IAAI,EAAE,SAAS,YAAY,EAAE,GAC/B,YAAY,CAQd"}
package/dist/period.js ADDED
@@ -0,0 +1,119 @@
1
+ import { isoToUnixSeconds, lastSecondOf } from './schema.js';
2
+ /**
3
+ * The stored start of a period with no known beginning (`../1607`, `/1607`).
4
+ * An exact int64 further back than any year a source states – about 146
5
+ * billion years, ten times the age of the universe – so a period open at its
6
+ * start overlaps every range that reaches back far enough to meet its end.
7
+ * The codec reads years to ±2⁶³ seconds; a bound past ±2⁶² is not refused,
8
+ * just never a real one.
9
+ */
10
+ export const OPEN_START = -(2 ** 62);
11
+ /** The stored end of a period with no known end (`1440/..`, `1440/`); the
12
+ * mirror of {@link OPEN_START}. */
13
+ export const OPEN_END = 2 ** 62;
14
+ /**
15
+ * The period one value covers, or `undefined` for a value that states none.
16
+ *
17
+ * A value is an [EDTF](https://www.loc.gov/standards/datetime/) Level 0 or 1
18
+ * date or interval, or anything the `date` codec reads ({@link
19
+ * isoToUnixSeconds}): an `xsd:date`, `xsd:gYear`, `xsd:dateTime` or a
20
+ * deep-time year. What each covers, from its first second to its last:
21
+ *
22
+ * | Value | Covers |
23
+ * | ----------------- | ------------------------------- |
24
+ * | `1935` | all of 1935 |
25
+ * | `1935/1955` | 1935 through 1955 |
26
+ * | `1620~`, `1620?` | all of 1620 – the qualifier is not a margin |
27
+ * | `162X` | 1620 through 1629 |
28
+ * | `1620-XX`, `1606-21` | all of 1620, all of 1606 – a season is its year |
29
+ * | `1440/..`, `1440/`| 1440 onwards, unbounded |
30
+ * | `../1607` | everything up to the end of 1607 |
31
+ *
32
+ * **An unknown bound reads as an open one.** EDTF tells them apart (`1440/` is
33
+ * an end nobody knows, `1440/..` one that has not come), but a range filter
34
+ * must answer for both, and leaving a work out of every result it might belong
35
+ * to costs a reader more than one extra hit.
36
+ *
37
+ * **Each side is read on its own**, through the `date` codec: an empty or `..`
38
+ * side is open, and what only EDTF states is rewritten into a form the codec
39
+ * reads – a qualifier dropped, an unspecified month or day dropped to the
40
+ * coarser precision, a season read as its year (EDTF fixes no months for it),
41
+ * unspecified year digits read as their lowest and highest. Anything else
42
+ * EDTF Level 1 does not allow, such as Level 2’s `1950S2`, states no period.
43
+ * A value open at both ends, or ending before it starts, is no period at all.
44
+ */
45
+ export function periodOf(value) {
46
+ const sides = value.split('/');
47
+ if (sides.length > 2) {
48
+ return undefined;
49
+ }
50
+ const from = sideOf(sides[0]);
51
+ // A plain date is its own first and last side.
52
+ const to = sides.length === 1 ? from : sideOf(sides[1]);
53
+ if (from === undefined || to === undefined) {
54
+ return undefined;
55
+ }
56
+ const { start } = from;
57
+ const { end } = to;
58
+ const openAtBothEnds = start === OPEN_START && end === OPEN_END;
59
+ return start <= end && !openAtBothEnds ? { start, end } : undefined;
60
+ }
61
+ /**
62
+ * The period several periods cover between them: the earliest start and the
63
+ * latest end. One stored range per document is what an engine can sort on and
64
+ * compare in a single clause, so a work dated `1668`, `1676` and `1686` is
65
+ * stored as 1668 through 1686 – and a range falling between its dates still
66
+ * matches it.
67
+ */
68
+ export function periodCovering(first, ...rest) {
69
+ return rest.reduce((covered, period) => ({
70
+ start: Math.min(covered.start, period.start),
71
+ end: Math.max(covered.end, period.end),
72
+ }), first);
73
+ }
74
+ /** One side of an interval, or a whole plain value. */
75
+ function sideOf(text) {
76
+ const side = text.trim();
77
+ // EDTF’s open (`..`) and unknown (empty) bounds, both read as open.
78
+ if (side === '' || side === '..') {
79
+ return { start: OPEN_START, end: OPEN_END };
80
+ }
81
+ // A plain date, the common case, needs no rewriting.
82
+ const plain = isoToUnixSeconds(side.replace(DEEP_YEAR, '$1'));
83
+ if (plain !== undefined) {
84
+ return { start: plain.seconds, end: lastSecondOf(plain) };
85
+ }
86
+ // What only EDTF states, rewritten into a form the codec reads.
87
+ const date = side
88
+ .replace(HOURS_ONLY_SHIFT, '$1:00')
89
+ .replace(QUALIFIER, '$1')
90
+ .replace(DEEP_YEAR, '$1')
91
+ .replace(UNSPECIFIED_MONTH_OR_SEASON, '$1')
92
+ .replace(UNSPECIFIED_DAY, '$1');
93
+ const [lowest, highest] = UNSPECIFIED_YEAR.test(date)
94
+ ? [date.replaceAll('X', '0'), date.replaceAll('X', '9')]
95
+ : [date, date];
96
+ const first = isoToUnixSeconds(lowest);
97
+ const last = isoToUnixSeconds(highest);
98
+ return first === undefined || last === undefined
99
+ ? undefined
100
+ : { start: first.seconds, end: lastSecondOf(last) };
101
+ }
102
+ /** A time shift of whole hours (`T10:10:10+05`), which EDTF allows and the
103
+ * codec reads only as `+05:00`. */
104
+ const HOURS_ONLY_SHIFT = /(T[\d:.]+[+-]\d{2})$/;
105
+ /** An EDTF Level 1 qualifier – `~` approximate, `?` uncertain, `%` both – on a
106
+ * date. It is part of what is known, not a margin, so the date is read
107
+ * without it. */
108
+ const QUALIFIER = /^([^T]+)[~?%]$/;
109
+ /** An EDTF `Y` year – a year of any length, signed – read as the bare year
110
+ * the codec stores it as. */
111
+ const DEEP_YEAR = /^Y([+-]?\d+)$/;
112
+ /** An unspecified month (`1620-XX`, `1620-XX-XX`) or a season (`1606-21` to
113
+ * `1606-24`), read as the year. */
114
+ const UNSPECIFIED_MONTH_OR_SEASON = /^([+-]?\d{4,})-(?:XX(?:-XX)?|2[1-4])$/;
115
+ /** An unspecified day (`1620-05-XX`), read as the month. */
116
+ const UNSPECIFIED_DAY = /^([+-]?\d{4,}-\d{2})-XX$/;
117
+ /** A year with unspecified trailing digits: `162X`, `16XX`. Not `XXXX`, which
118
+ * knows no more than `../..`. */
119
+ const UNSPECIFIED_YEAR = /^(?=.{4}$)\d+X+$/;
package/dist/project.d.ts CHANGED
@@ -27,6 +27,24 @@ export type SearchDocument = {
27
27
  export interface ProjectionContext extends Partial<Readonly<Record<ProjectionValue, string>>> {
28
28
  /** The IRI of the dataset being indexed. */
29
29
  readonly dataset?: string;
30
+ /**
31
+ * Called once for each value a typed field could not read and so left out:
32
+ * a `date` over `Z.j`, an `integer` over `onbekend`, a `period` over
33
+ * `1987/1897`, a `reference` over a literal, a `boolean` outside
34
+ * `true`/`false`/`1`/`0`. Values from a `derive` count too; one that is not
35
+ * a string is reported as `String(value)`.
36
+ */
37
+ readonly onUnreadable?: (unreadable: UnreadableValue) => void;
38
+ }
39
+ /** A value a typed field could not read ({@link ProjectionContext.onUnreadable}). */
40
+ export interface UnreadableValue {
41
+ /** The field that could not read it; dotted for a field of a nested
42
+ * referent (`creator.birthDate`). */
43
+ readonly field: string;
44
+ /** The value as the source – or the derive – stated it. */
45
+ readonly value: string;
46
+ /** The IRI of the node the document was projected from. */
47
+ readonly id: string;
30
48
  }
31
49
  /**
32
50
  * Project one framed JSON-LD node into a flat search document: apply each field
@@ -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;AAGzC,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAuBL,KAAK,eAAe,EAIpB,KAAK,QAAQ,EAEb,KAAK,YAAY,EACjB,KAAK,UAAU,EAGhB,MAAM,aAAa,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,+DAA+D;AAC/D,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAkB,SAAQ,OAAO,CAChD,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAC1C;IACC,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAKD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,UAAU,EACtB,MAAM,CAAC,EAAE,YAAY,EACrB,OAAO,GAAE,iBAAyC,GACjD,cAAc,CAgBhB;AAmLD;;;;;;;;;;;;GAYG;AACH,wBAAuB,YAAY,CACjC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,EACrB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,MAAM,E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AAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAKD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,UAAU,EACtB,MAAM,CAAC,EAAE,YAAY,EACrB,OAAO,GAAE,iBAAyC,GACjD,cAAc,CAkBhB;AAgMD;;;;;;;;;;;;GAYG;AACH,wBAAuB,YAAY,CACjC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,EACrB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,QAAQ,EACpB,OAAO,GAAE,iBAAyC,GACjD,aAAa,CAAC,cAAc,CAAC,CAc/B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,EACvB,UAAU,EAAE,UAAU,EACtB,MAAM,CAAC,EAAE,YAAY,GACpB,SAAS,MAAM,EAAE,CAmCnB"}
package/dist/project.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { fold } from '@lde/text-normalization';
2
2
  import { matchLanguage } from './language.js';
3
3
  import { buildSubjectIndex, frameSubjects, } from './frame-by-type.js';
4
- import { assertTypeInSchema, displayFieldName, displayLangOf, documentKeyOf, endpointFieldOf, fieldNamed, identityFieldOf, inheritedFacetPolicies, inlineFramingDepth, irAlias, isAbsoluteIri, isInternalField, isInlineReference, isoToUnixSeconds, localLookupTargetsOf, physicalFields, referencedTargetsOf, referenceTypeNamed, storableUnixSeconds, storedTargetOf, TARGET_FIELD, } from './schema.js';
4
+ import { companionNames, assertTypeInSchema, displayFieldName, displayLangOf, documentKeyOf, endpointFieldOf, fieldNamed, identityFieldOf, inheritedFacetPolicies, inlineFramingDepth, irAlias, isAbsoluteIri, isInternalField, isInlineReference, isoToUnixSeconds, localLookupTargetsOf, physicalFields, referencedTargetsOf, referenceTypeNamed, storableUnixSeconds, storedTargetOf, TARGET_FIELD, } from './schema.js';
5
+ import { periodCovering, periodOf } from './period.js';
5
6
  /** The context a projection runs with when its caller supplied none. */
6
7
  const NO_PROJECTION_CONTEXT = {};
7
8
  /**
@@ -19,12 +20,13 @@ const NO_PROJECTION_CONTEXT = {};
19
20
  * the engine collection definition and the query compiler.
20
21
  */
21
22
  export function projectDocument(node, searchType, schema, context = NO_PROJECTION_CONTEXT) {
22
- if (documentKey(node) === undefined) {
23
+ const key = documentKey(node);
24
+ if (key === undefined) {
23
25
  throw new Error(`Cannot project a “${searchType.name}” node whose @id is not an absolute IRI (got ${JSON.stringify(node['@id']) ?? 'none'}; a blank node label or a relative reference is not one): every search document needs a stable key, and an empty one would collide with other keyless nodes.`);
24
26
  }
25
27
  // The guard above is what makes this a SearchDocument: projectFields sets `id`
26
28
  // for exactly the nodes documentKey resolves.
27
- const document = projectFields(node, searchType, schema, context);
29
+ const document = projectFields(node, searchType, schema, context, unreadableSink(context, key));
28
30
  pruneInternalFields(document, searchType, schema);
29
31
  return document;
30
32
  }
@@ -59,7 +61,10 @@ function pruneInternalFields(document, searchType, schema) {
59
61
  }
60
62
  for (const field of searchType.fields) {
61
63
  if (isInternalField(field)) {
62
- delete document[field.name];
64
+ // With its companions, which no collection declares for it either.
65
+ for (const name of [field.name, ...companionNames(field)]) {
66
+ delete document[name];
67
+ }
63
68
  continue;
64
69
  }
65
70
  if (schema === undefined || field.kind !== 'reference') {
@@ -89,10 +94,10 @@ function pruneInternalFields(document, searchType, schema) {
89
94
  * Pruning is deferred to a single recursive pass ({@link pruneInternalFields})
90
95
  * once the whole nested structure is projected, so a derive at any depth can
91
96
  * still read an internal field before it is removed. */
92
- function projectFields(node, searchType, schema, context, nested = false) {
97
+ function projectFields(node, searchType, schema, context, sink, nested = false) {
93
98
  const document = emptyDocument(documentIdOf(node, searchType), searchType);
94
99
  for (const field of searchType.fields) {
95
- applyField(document, node, field, searchType, schema, context, nested);
100
+ applyField(document, node, field, searchType, schema, context, sink, nested);
96
101
  }
97
102
  return document;
98
103
  }
@@ -251,7 +256,13 @@ function hasValue(document, field, searchType) {
251
256
  (displayLangOf(field, key) !== undefined &&
252
257
  fieldNamed(searchType, key) === undefined)));
253
258
  }
254
- function applyField(document, node, field, searchType, schema, context, nested) {
259
+ function applyField(document, node, field, searchType, schema, context, sink, nested) {
260
+ // A blank value states nothing, so there is nothing to correct at the source.
261
+ const unread = (value) => {
262
+ if (value.trim() !== '') {
263
+ sink(field.name, value);
264
+ }
265
+ };
255
266
  // The three value sources, mutually exclusive by declaration
256
267
  // (`validateSearchType`): a projection value, a computed value, a graph path.
257
268
  if ((field.kind === 'keyword' || field.kind === 'reference') &&
@@ -267,10 +278,13 @@ function applyField(document, node, field, searchType, schema, context, nested)
267
278
  // value that survives nothing leaves the field absent, exactly as a derive
268
279
  // returning `undefined` does.
269
280
  if (field.kind === 'date') {
270
- return applyDerivedDate(document, field, derived);
281
+ return applyDerivedDate(document, field, derived, unread);
282
+ }
283
+ if (field.kind === 'period') {
284
+ return setPeriod(document, field, derivedStrings(derived, unread), unread);
271
285
  }
272
286
  const value = field.kind === 'reference' && derived !== undefined
273
- ? derivedIris(derived)
287
+ ? derivedIris(derived, unread)
274
288
  : derived;
275
289
  // NaN is not a value any kind stores, and a derive is the only route that
276
290
  // can produce one (`setNumber` guards the read route). It serializes as
@@ -279,6 +293,9 @@ function applyField(document, node, field, searchType, schema, context, nested)
279
293
  if (value !== undefined && !Number.isNaN(value)) {
280
294
  document[field.name] = value;
281
295
  }
296
+ else if (value !== undefined) {
297
+ unread(String(value));
298
+ }
282
299
  return;
283
300
  }
284
301
  if (field.path === undefined && field.name !== searchType.literalField) {
@@ -300,7 +317,7 @@ function applyField(document, node, field, searchType, schema, context, nested)
300
317
  // project nothing rather than fall through and emit the referent IRIs under
301
318
  // the field name (the wrong shape).
302
319
  if (schema !== undefined) {
303
- applyInlineReference(document, node, alias, field, schema, context, nested);
320
+ applyInlineReference(document, node, alias, field, schema, context, sink, nested);
304
321
  }
305
322
  return;
306
323
  }
@@ -311,7 +328,7 @@ function applyField(document, node, field, searchType, schema, context, nested)
311
328
  if (field.kind === 'reference' && schema !== undefined) {
312
329
  const localTargets = localLookupTargetsOf(field, schema);
313
330
  if (localTargets.length > 0) {
314
- const endpoints = applyNestedReferents(document, valuesOf(node, alias), field, localTargets, schema, context);
331
+ const endpoints = applyNestedReferents(document, valuesOf(node, alias), field, localTargets, schema, context, sink);
315
332
  // A `local` lookup stores an object, so its own id is a level deeper than
316
333
  // a filter can reach – an engine welds conditions on an entry's LEAF
317
334
  // fields only, and facets flat values. `filterable` and `facetable`
@@ -328,24 +345,41 @@ function applyField(document, node, field, searchType, schema, context, nested)
328
345
  return applyFacet(document, literalsOf(node, alias), field, schema);
329
346
  case 'reference': {
330
347
  const targetsById = new Map();
331
- const values = referenceValues(node, alias, field, schema, targetsById);
348
+ const values = referenceValues(node, alias, field, schema, targetsById, unread);
332
349
  rememberTargets(document, targetsById);
333
350
  return applyFacet(document, values, field, schema, targetsById);
334
351
  }
335
352
  case 'integer':
336
- return setNumber(document, field.name, toInteger(firstLiteralOf(node, alias)));
337
- case 'number':
338
- return setNumber(document, field.name, toNumber(firstLiteralOf(node, alias)));
353
+ case 'number': {
354
+ const literal = firstLiteralOf(node, alias);
355
+ const value = field.kind === 'integer' ? toInteger(literal) : toNumber(literal);
356
+ if (literal !== undefined && Number.isNaN(value)) {
357
+ unread(literal);
358
+ }
359
+ return setNumber(document, field.name, value);
360
+ }
339
361
  case 'date': {
340
362
  const literal = firstLiteralOf(node, alias);
341
- return setDate(document, field, literal === undefined ? undefined : isoToUnixSeconds(literal));
363
+ const stored = literal === undefined ? undefined : isoToUnixSeconds(literal);
364
+ if (literal !== undefined && stored === undefined) {
365
+ unread(literal);
366
+ }
367
+ return setDate(document, field, stored);
342
368
  }
369
+ case 'period':
370
+ return setPeriod(document, field, literalsOf(node, alias), unread);
343
371
  case 'boolean': {
344
- // The xsd:boolean lexical space: true/false/1/0.
345
- const literal = firstLiteralOf(node, alias);
346
- if (literal !== undefined) {
347
- document[field.name] = literal === 'true' || literal === '1';
372
+ // The xsd:boolean lexical space: true/false/1/0. Anything else – `ja`,
373
+ // `yes` – states neither, so it is left out rather than stored as false.
374
+ // Surrounding whitespace is collapsed, as xsd:boolean’s facet says.
375
+ const literal = firstLiteralOf(node, alias)?.trim();
376
+ if (literal === undefined) {
377
+ return;
378
+ }
379
+ if (!BOOLEAN_LEXICAL_SPACE.has(literal)) {
380
+ return unread(literal);
348
381
  }
382
+ document[field.name] = literal === 'true' || literal === '1';
349
383
  return;
350
384
  }
351
385
  }
@@ -376,7 +410,16 @@ function applyField(document, node, field, searchType, schema, context, nested)
376
410
  * referent’s node IRIs therefore sees a key instead, which is why the two are
377
411
  * worth declaring together only deliberately.
378
412
  */
379
- function referenceValues(node, alias, field, schema, targetsById) {
413
+ function referenceValues(node, alias, field, schema, targetsById, unread) {
414
+ // A literal where a referent belongs states no IRI to store. A node without
415
+ // one – a blank node – carries no value a publisher could look up, so only
416
+ // literals are reported.
417
+ for (const value of valuesOf(node, alias)) {
418
+ const literal = iriString(value) === undefined ? literalString(value) : undefined;
419
+ if (literal !== undefined) {
420
+ unread(literal);
421
+ }
422
+ }
380
423
  // Guaranteed declared: `searchSchema` validates that every named target
381
424
  // resolves, and the projection only ever runs against a type of its schema.
382
425
  const targets = referencedTargetsOf(field, schema);
@@ -676,7 +719,7 @@ function applyProjectionValue(document, field, from, context, schema) {
676
719
  * the schema’s declared depth. The referent type is guaranteed declared by
677
720
  * {@link searchSchema}.
678
721
  */
679
- function applyInlineReference(document, node, alias, field, schema, context, nested) {
722
+ function applyInlineReference(document, node, alias, field, schema, context, sink, nested) {
680
723
  // Resolves for a schema that declares the referent (always so for the schema a
681
724
  // type is projected through); a type framed against a foreign schema that
682
725
  // omits it simply contributes no nesting.
@@ -686,7 +729,7 @@ function applyInlineReference(document, node, alias, field, schema, context, nes
686
729
  }
687
730
  const asEdge = edgeReader(referenceType, field.ref.identity);
688
731
  const asLiteralEntry = literalReader(referenceType);
689
- const referents = applyNestedReferents(document, valuesOf(node, alias).map((value) => asLiteralEntry(value) ?? asEdge(value)), field, [referenceType], schema, context);
732
+ const referents = applyNestedReferents(document, valuesOf(node, alias).map((value) => asLiteralEntry(value) ?? asEdge(value)), field, [referenceType], schema, context, sink);
690
733
  applyIdentityCompanion(document, referents, field, schema, nested);
691
734
  }
692
735
  /**
@@ -888,7 +931,7 @@ function identityValue(value) {
888
931
  * top-level document of that type would be – so the stored id is the one the
889
932
  * target’s collection files it under, and the lookup can find it.
890
933
  */
891
- function applyNestedReferents(document, values, field, nestedTypes, schema, context) {
934
+ function applyNestedReferents(document, values, field, nestedTypes, schema, context, sink) {
892
935
  // One node may stand for several entries: a weldable leaf is single-valued,
893
936
  // so an edge the graph gave several roles or several endpoints fans out into
894
937
  // one entry per combination BEFORE it is projected (ADR 26).
@@ -901,8 +944,18 @@ function applyNestedReferents(document, values, field, nestedTypes, schema, cont
901
944
  const nestedType = nestedTypes.length === 1
902
945
  ? nestedTypes[0]
903
946
  : targetOfReferent(value, nestedTypes);
947
+ // Every tuple of a node carries the node’s other values, so each value
948
+ // is reported once per node, not once per tuple it was copied into.
949
+ let reported;
950
+ const nestedSink = (name, value) => {
951
+ const key = JSON.stringify([name, value]);
952
+ if (!(reported ??= new Set()).has(key)) {
953
+ reported.add(key);
954
+ sink(`${field.name}.${name}`, value);
955
+ }
956
+ };
904
957
  return tuplesOf(value, nestedType, field).map((tuple) => {
905
- const projected = projectFields(tuple, nestedType, schema, context, true);
958
+ const projected = projectFields(tuple, nestedType, schema, context, nestedSink, true);
906
959
  if (nestedTypes.length > 1 && Object.keys(projected).length > 0) {
907
960
  projected[TARGET_FIELD] = nestedType.name;
908
961
  }
@@ -1071,11 +1124,18 @@ function iriString(value) {
1071
1124
  * promises (a list stays a list, a single value stays single) so `array` still
1072
1125
  * decides the stored shape. A lone non-IRI becomes `undefined`, i.e. absent –
1073
1126
  * the same outcome the graph path gives it. */
1074
- function derivedIris(value) {
1127
+ function derivedIris(value, unread) {
1128
+ const isIri = (entry) => {
1129
+ const iri = typeof entry === 'string' && isAbsoluteIri(entry);
1130
+ if (!iri && entry !== undefined) {
1131
+ unread(String(entry));
1132
+ }
1133
+ return iri;
1134
+ };
1075
1135
  if (Array.isArray(value)) {
1076
- return value.filter((entry) => typeof entry === 'string' && isAbsoluteIri(entry));
1136
+ return value.filter(isIri);
1077
1137
  }
1078
- return typeof value === 'string' && isAbsoluteIri(value) ? value : undefined;
1138
+ return isIri(value) ? value : undefined;
1079
1139
  }
1080
1140
  function toInteger(literal) {
1081
1141
  return literal === undefined ? undefined : Math.trunc(Number(literal));
@@ -1093,16 +1153,22 @@ function toNumber(literal) {
1093
1153
  * field is stored in would be refused by the engine where an unparseable
1094
1154
  * string merely leaves the field absent – so drop those too.
1095
1155
  */
1096
- function applyDerivedDate(document, field, derived) {
1156
+ function applyDerivedDate(document, field, derived, unread) {
1157
+ let stored;
1097
1158
  if (typeof derived === 'string') {
1098
- return setDate(document, field, isoToUnixSeconds(derived));
1159
+ stored = isoToUnixSeconds(derived);
1099
1160
  }
1100
- if (typeof derived === 'number') {
1161
+ else if (typeof derived === 'number') {
1101
1162
  // Truncated, as the codec truncates a string’s fractional seconds: the
1102
1163
  // field is an int64. `storableUnixSeconds` drops NaN.
1103
1164
  const seconds = storableUnixSeconds(Math.trunc(derived));
1104
- return setDate(document, field, seconds === undefined ? undefined : { seconds, precision: 'dateTime' });
1165
+ stored =
1166
+ seconds === undefined ? undefined : { seconds, precision: 'dateTime' };
1105
1167
  }
1168
+ if (derived !== undefined && stored === undefined) {
1169
+ unread(String(derived));
1170
+ }
1171
+ setDate(document, field, stored);
1106
1172
  }
1107
1173
  /** Store a `date` field’s seconds, and its precision in the companion beside
1108
1174
  * them ({@link physicalFields}), so the surface can serve the value in the
@@ -1114,6 +1180,56 @@ function setDate(document, field, stored) {
1114
1180
  document[field.name] = stored.seconds;
1115
1181
  document[physicalFields(field).precision] = stored.precision;
1116
1182
  }
1183
+ /**
1184
+ * Store a `period` field: the values that state a period, verbatim under the
1185
+ * field’s own name, for output, and the stretch they cover between them in the
1186
+ * bound companions ({@link physicalFields}). A value that states no period –
1187
+ * `onbekend`, `1987/1897` – is reported and left out, so every value served is
1188
+ * the EDTF its scalar promises; a deployment that wants to show such text
1189
+ * declares a `keyword` field over the same path.
1190
+ *
1191
+ * Blank and unreadable values are dropped before a single-valued field keeps
1192
+ * its first, so neither can cost the field the period behind it; and the
1193
+ * bounds are taken from exactly the values stored, so what is served and what
1194
+ * is filtered cannot disagree.
1195
+ */
1196
+ function setPeriod(document, field, values, unread) {
1197
+ const readable = dedupe(values.map((value) => value.trim())).flatMap((value) => {
1198
+ if (value === '') {
1199
+ return [];
1200
+ }
1201
+ const period = periodOf(value);
1202
+ if (period === undefined) {
1203
+ unread(value);
1204
+ return [];
1205
+ }
1206
+ return [{ value, period }];
1207
+ });
1208
+ const stated = field.array === true ? readable : readable.slice(0, 1);
1209
+ if (stated.length === 0) {
1210
+ return;
1211
+ }
1212
+ document[field.name] =
1213
+ field.array === true ? stated.map(({ value }) => value) : stated[0].value;
1214
+ const companions = physicalFields(field).period;
1215
+ if (companions !== undefined) {
1216
+ const [first, ...rest] = stated.map(({ period }) => period);
1217
+ const covered = periodCovering(first, ...rest);
1218
+ document[companions.start] = covered.start;
1219
+ document[companions.end] = covered.end;
1220
+ }
1221
+ }
1222
+ /** A derive’s value as the strings a `period` stores: one string, or the
1223
+ * strings in a list; anything else states no value. */
1224
+ function derivedStrings(derived, unread) {
1225
+ const values = Array.isArray(derived) ? derived : [derived];
1226
+ return values.filter((value) => {
1227
+ if (typeof value !== 'string' && value !== undefined) {
1228
+ unread(String(value));
1229
+ }
1230
+ return typeof value === 'string';
1231
+ });
1232
+ }
1117
1233
  function setNumber(document, field, value) {
1118
1234
  if (value !== undefined && !Number.isNaN(value)) {
1119
1235
  document[field] = value;
@@ -1147,3 +1263,22 @@ function setArray(document, field, values) {
1147
1263
  function isObject(value) {
1148
1264
  return typeof value === 'object' && value !== null && !Array.isArray(value);
1149
1265
  }
1266
+ /** The sink a root document’s fields report to: the context’s
1267
+ * {@link ProjectionContext.onUnreadable}, told which node the value was
1268
+ * dropped from. */
1269
+ function unreadableSink(context, id) {
1270
+ const { onUnreadable } = context;
1271
+ return onUnreadable === undefined
1272
+ ? ignoreUnreadable
1273
+ : (field, value) => onUnreadable({ field, value, id });
1274
+ }
1275
+ function ignoreUnreadable() {
1276
+ // Nobody asked for the report.
1277
+ }
1278
+ /** The xsd:boolean lexical space. */
1279
+ const BOOLEAN_LEXICAL_SPACE = new Set([
1280
+ 'true',
1281
+ 'false',
1282
+ '1',
1283
+ '0',
1284
+ ]);
package/dist/query.d.ts CHANGED
@@ -281,7 +281,15 @@ export interface QueryIssue {
281
281
  * and a rejected criterion answers a narrower one. Neither is the query,
282
282
  * and only the caller can fix the bound.
283
283
  */
284
- | 'unparseable-bound';
284
+ | 'unparseable-bound'
285
+ /**
286
+ * A range whose `min` comes after its `max` – for a `date` or `period`,
287
+ * after the last second `max` names (`1950` to `1940`, not `1950` to
288
+ * `1950`). A `date` field would match nothing and a
289
+ * `period` everything spanning the gap, and neither is what the caller
290
+ * meant, so the caller is told.
291
+ */
292
+ | 'inverted-range';
285
293
  }
286
294
  /**
287
295
  * A resolved {@link CriterionBase.on} path: which type the leaf field belongs
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,UAAU,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,2EAA2E;IAC3E,QAAQ,CAAC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@
1
- import { fieldNamed, filterOperatorFor, ID_FIELD, isoToUnixSeconds, nestedReferenceType, referencedTargetsOf, } from './schema.js';
1
+ import { fieldNamed, filterOperatorFor, ID_FIELD, nestedReferenceType, referencedTargetsOf, storedRangeBound, } from './schema.js';
2
2
  import { MAX_JOIN_DEPTH } from './join-graph.js';
3
3
  /** Whether a criterion welds conditions to one entry ({@link WeldedCriterion}). */
4
4
  export function isWelded(criterion) {
@@ -113,7 +113,8 @@ export function facetSearches(query) {
113
113
  /**
114
114
  * The checks every leaf criterion answers to, wherever it sits: the field is
115
115
  * declared and `filterable` on the type it constrains, its operator matches
116
- * that field's kind, and a `date` range's bounds are readable.
116
+ * that field's kind, and a `date` or `period` range's bounds are readable and
117
+ * in order.
117
118
  *
118
119
  * Shared by an ordinary criterion and by each condition welded to an entry, so
119
120
  * a welded condition is held to exactly the same rules – there is no second,
@@ -134,13 +135,15 @@ function collectLeafIssues(criterion, constrained, field, issues) {
134
135
  issues.push({ part: 'where', field, reason: 'operator-mismatch' });
135
136
  return;
136
137
  }
137
- if (declared.kind === 'date' && 'range' in criterion) {
138
- // A `date` bound is ISO 8601 at the edge and Unix seconds in storage, so a
139
- // bound the codec cannot read has nothing to compare against. Both bounds
140
- // are checked, so a caller who wrote two bad ones is told about both
141
- // instead of fixing one to be told about the other.
142
- for (const bound of [criterion.range.min, criterion.range.max]) {
143
- if (typeof bound === 'string' && isoToUnixSeconds(bound) === undefined) {
138
+ if ('range' in criterion) {
139
+ // A `date` or `period` bound is ISO 8601 at the edge and Unix seconds in
140
+ // storage, so a bound the codec cannot read has nothing to compare
141
+ // against. Both bounds are checked, so a caller who wrote two bad ones is
142
+ // told about both instead of fixing one to be told about the other.
143
+ const [min, max] = ['min', 'max'].map((side) => {
144
+ const bound = criterion.range[side] ?? undefined;
145
+ const stored = storedRangeBound(declared, bound, side);
146
+ if (typeof bound === 'string' && stored === undefined) {
144
147
  issues.push({
145
148
  part: 'where',
146
149
  field,
@@ -148,6 +151,10 @@ function collectLeafIssues(criterion, constrained, field, issues) {
148
151
  reason: 'unparseable-bound',
149
152
  });
150
153
  }
154
+ return stored;
155
+ });
156
+ if (min !== undefined && max !== undefined && min > max) {
157
+ issues.push({ part: 'where', field, reason: 'inverted-range' });
151
158
  }
152
159
  }
153
160
  }
package/dist/schema.d.ts CHANGED
@@ -6,7 +6,7 @@ import type { ProjectedNode, ProjectionContext } from './project.js';
6
6
  * output/input type. The Typesense-vocabulary types (`string`, `int32`, …) are
7
7
  * *derived* from this by the engine adapter, never declared here.
8
8
  */
9
- export type FieldKind = 'text' | 'keyword' | 'integer' | 'number' | 'boolean' | 'date' | 'reference';
9
+ export type FieldKind = 'text' | 'keyword' | 'integer' | 'number' | 'boolean' | 'date' | 'period' | 'reference';
10
10
  /** The `where` operator a kind accepts, or `undefined` when it is not filterable
11
11
  * through `where` (`text` feeds the free-text `query` instead). */
12
12
  export type FilterOperator = 'in' | 'range' | 'is';
@@ -53,7 +53,7 @@ export declare function filterOperatorFor(kind: FieldKind): FilterOperator | und
53
53
  * `ref`←`sh:node`/`sh:class`),
54
54
  * and a hand-written declaration is just as valid.
55
55
  */
56
- export type SearchField = TextField | KeywordField | ReferenceField | NumericField | BooleanField;
56
+ export type SearchField = TextField | KeywordField | ReferenceField | NumericField | PeriodField | BooleanField;
57
57
  /** The declaration members every {@link SearchField} kind shares. */
58
58
  export interface SearchFieldBase {
59
59
  /** Logical API name; the physical fanout derives from it. Declare camelCase
@@ -372,6 +372,40 @@ export interface DateField extends SearchFieldBase, RangeFacetable<DateFacetRang
372
372
  readonly kind: 'date';
373
373
  readonly searchable?: never;
374
374
  }
375
+ /**
376
+ * A stretch of time, stated as an [EDTF](https://www.loc.gov/standards/datetime/)
377
+ * value or an ISO 8601 date: `1935/1955`, `1620~`, `162X`, `1440/..`. Where a
378
+ * `date` holds one instant, a period holds what its source knows – often only
379
+ * that something happened somewhere between two dates.
380
+ *
381
+ * - **Output** is each value verbatim, as its source stated it: `1620~` stays
382
+ * `1620~`, because the qualifier is part of what is known and how to render
383
+ * it (“c. 1620”) depends on the reader’s language.
384
+ * - **A range filter matches by overlap**: `{ min: '1940', max: '1950' }`
385
+ * matches `1935/1955`, which a filter on a start date alone would miss. The
386
+ * bounds are ISO 8601, as a `date` filter’s are, and `max` reaches through
387
+ * the end of the period it names.
388
+ * - **Sorting** ascending orders on the earliest second a value allows,
389
+ * descending on the latest, so “newest first” places `1935/1955` by 1955.
390
+ *
391
+ * The bounds are two companions the engine stores beside the values
392
+ * ({@link PhysicalFields.period}), never fields a client sees. An `array`
393
+ * field is stored as the one stretch its values cover between them – the
394
+ * earliest start to the latest end – since that is what an engine can sort on
395
+ * and test in one clause. A value no reader can parse is still served; it just
396
+ * takes no part in filtering or sorting.
397
+ *
398
+ * Not facetable: a period belongs in every bin it overlaps, which no engine
399
+ * facet counts from two bounds. And filtered only on the document that holds
400
+ * it, never through a nesting or a weld: the two bounds are compared in one
401
+ * clause, which a nested entry has no room for.
402
+ */
403
+ export interface PeriodField extends SearchFieldBase {
404
+ readonly kind: 'period';
405
+ readonly searchable?: never;
406
+ readonly facetable?: never;
407
+ readonly facetRanges?: never;
408
+ }
375
409
  /** A boolean flag; absent in a document means `false`. */
376
410
  export interface BooleanField extends SearchFieldBase {
377
411
  readonly kind: 'boolean';
@@ -804,7 +838,7 @@ export declare function storedTargetOf(entry: Readonly<Record<string, unknown>>,
804
838
  */
805
839
  export interface SearchTypeIssue {
806
840
  readonly field: string;
807
- readonly reason: 'duplicate-field-name' | 'invalid-field-name' | 'unknown-kind' | 'invalid-locale' | 'missing-ref' | 'missing-ref-type-name' | 'ref-not-allowed' | 'text-requires-locales' | 'locales-not-allowed' | 'facet-ranges-not-allowed' | 'unparseable-facet-range' | 'searchable-not-allowed' | 'transform-not-allowed' | 'derive-with-path' | 'from-not-allowed' | 'from-with-path' | 'from-with-derive' | 'from-with-inline-ref' | 'unknown-projection-value' | 'duplicate-projection-value' | 'text-not-filterable' | 'text-not-facetable' | 'joinable-not-allowed' | 'joinable-without-label-source' | 'joinable-with-inline-ref' | 'joinable-with-several-targets' | 'duplicate-target' | 'empty-target' | 'reserved-field-name' | 'key-field-unknown' | 'key-field-not-reference' | 'key-field-without-path' | 'key-field-not-array' | 'key-field-inline' | 'key-pick-not-a-function' | 'key-not-allowed' | 'facet-keys-only-not-a-function' | 'facet-keys-not-allowed';
841
+ readonly reason: 'duplicate-field-name' | 'invalid-field-name' | 'unknown-kind' | 'invalid-locale' | 'missing-ref' | 'missing-ref-type-name' | 'ref-not-allowed' | 'text-requires-locales' | 'locales-not-allowed' | 'facet-ranges-not-allowed' | 'unparseable-facet-range' | 'searchable-not-allowed' | 'transform-not-allowed' | 'derive-with-path' | 'from-not-allowed' | 'from-with-path' | 'from-with-derive' | 'from-with-inline-ref' | 'unknown-projection-value' | 'duplicate-projection-value' | 'text-not-filterable' | 'text-not-facetable' | 'period-not-facetable' | 'joinable-not-allowed' | 'joinable-without-label-source' | 'joinable-with-inline-ref' | 'joinable-with-several-targets' | 'duplicate-target' | 'empty-target' | 'reserved-field-name' | 'key-field-unknown' | 'key-field-not-reference' | 'key-field-without-path' | 'key-field-not-array' | 'key-field-inline' | 'key-pick-not-a-function' | 'key-not-allowed' | 'facet-keys-only-not-a-function' | 'facet-keys-not-allowed';
808
842
  }
809
843
  /**
810
844
  * The reserved logical name of a document’s IRI – the one field every indexed
@@ -952,6 +986,20 @@ export interface PhysicalFields {
952
986
  * other kind.
953
987
  */
954
988
  readonly precision: string | undefined;
989
+ /**
990
+ * The **bound companions** of a `period` field: `${name}_start` and
991
+ * `${name}_end`, the first and last second its values cover, in Unix
992
+ * seconds. The field itself stores the values verbatim for output, so what
993
+ * a filter compares and a sort orders on lives here. Declared for every
994
+ * period, `filterable` and `sortable` or not: a deployment may sort on a
995
+ * field it does not expose as sortable, and two int64 values per document
996
+ * cost less than a sort the engine refuses. `undefined` for every other
997
+ * field.
998
+ */
999
+ readonly period: {
1000
+ readonly start: string;
1001
+ readonly end: string;
1002
+ } | undefined;
955
1003
  }
956
1004
  /** The physical name of an inline reference’s
957
1005
  * {@link ReferenceStrategy.identity identity companion}. */
@@ -1243,6 +1291,12 @@ export declare function unixSecondsToIso(seconds: number, precision: DatePrecisi
1243
1291
  * `2000` to a range that stops at `2000`, since those are stored there too.
1244
1292
  */
1245
1293
  export declare function lastSecondOf(stored: StoredDate): number;
1294
+ /** A range bound as stored: a `date` or `period` bound, ISO 8601 at the edge,
1295
+ * becomes Unix seconds ({@link isoToUnixSeconds}) – a `min` the first second
1296
+ * of what it names, a `max` the last ({@link lastSecondOf}), so the range
1297
+ * takes in the whole of each. Any other bound is stored as given; one the
1298
+ * codec cannot read is `undefined`. */
1299
+ export declare function storedRangeBound(field: SearchField, bound: number | string | undefined, side: 'min' | 'max'): number | string | undefined;
1246
1300
  /** `seconds` if a `date` field can store it – the int64 the engine keeps
1247
1301
  * Unix seconds in – or `undefined`, the same answer {@link isoToUnixSeconds}
1248
1302
  * gives a string it cannot parse. */
@@ -1263,6 +1317,9 @@ export declare function storableUnixSeconds(seconds: number): number | undefined
1263
1317
  * a schema, where it cannot re-key a reference either.
1264
1318
  */
1265
1319
  export declare function physicalFields(field: SearchField, schema?: SearchSchema): PhysicalFields;
1320
+ /** The value companions a field stores beside its own name: a `date`’s
1321
+ * precision, a `period`’s two bounds. */
1322
+ export declare function companionNames(field: SearchField): string[];
1266
1323
  /**
1267
1324
  * The {@link FacetKeys facet policies} a field inherits, keyed by the `name` of
1268
1325
  * the Root Type declaring each: the `facetKeys` of every type the field names
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGrE;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GACnB,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,CAAC;AAE/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YAAY,GAAG,SAAS,GAC/B,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAiBhC"}
package/dist/schema.js CHANGED
@@ -6,6 +6,7 @@ const OPERATOR_BY_KIND = {
6
6
  integer: 'range',
7
7
  number: 'range',
8
8
  date: 'range',
9
+ period: 'range',
9
10
  boolean: 'is',
10
11
  };
11
12
  /**
@@ -607,6 +608,9 @@ function assertServiceableNestedFields(referenceTypes) {
607
608
  if (field.labelSource !== undefined) {
608
609
  throw new Error(`Nested field “${referenceType.name}.${field.name}” declares a label source, which an inline reference cannot serve; declare a “lookup” on the nested reference instead of resolving a label for it.`);
609
610
  }
611
+ if (field.filterable === true && field.kind === 'period') {
612
+ throw new Error(`Nested field “${referenceType.name}.${field.name}” is a filterable “period”, which a weld cannot test: a period is matched by comparing two stored bounds, and a weld compares one value per condition. Declare it “output” only, or carry the period on the Root Type.`);
613
+ }
610
614
  if (field.filterable === true && field.array === true) {
611
615
  throw new Error(`Nested field “${referenceType.name}.${field.name}” declares both “filterable” and “array”: a weld asks whether ONE entry satisfies every condition, and an entry holding a list has no single value to test – it stands for each combination at once, so the weld degenerates into the cross-product it exists to exclude. Declare the field single-valued; the projection emits one entry per combination.`);
612
616
  }
@@ -966,11 +970,10 @@ export function validateSearchType(searchType) {
966
970
  const issues = [];
967
971
  const seen = new Set();
968
972
  const seenProjectionValues = new Set();
969
- // A `date` field stores its precision under `${name}_precision`, so a
970
- // declared field of that name would overwrite it, and be overwritten.
971
- const precisionCompanions = new Set(searchType.fields
972
- .filter((field) => field.kind === 'date')
973
- .map((field) => physicalFields(field).precision));
973
+ // A `date` field stores its precision under `${name}_precision`, and a
974
+ // `period` its bounds under `${name}_start` and `${name}_end`, so a declared
975
+ // field of such a name would overwrite one, and be overwritten.
976
+ const precisionCompanions = new Set(searchType.fields.flatMap(companionNames));
974
977
  for (const declared of searchType.fields) {
975
978
  // Validation guards declarations built OUTSIDE TypeScript (a SHACL
976
979
  // generator, plain JS), so it inspects the uniform flat shape rather
@@ -1087,8 +1090,11 @@ export function validateSearchType(searchType) {
1087
1090
  filterOperatorFor(field.kind) === undefined) {
1088
1091
  issue('text-not-facetable');
1089
1092
  }
1093
+ if (field.facetable === true && field.kind === 'period') {
1094
+ issue('period-not-facetable');
1095
+ }
1090
1096
  if (field.facetRanges !== undefined &&
1091
- filterOperatorFor(field.kind) !== 'range') {
1097
+ (filterOperatorFor(field.kind) !== 'range' || field.kind === 'period')) {
1092
1098
  issue('facet-ranges-not-allowed');
1093
1099
  }
1094
1100
  if (field.kind === 'date' &&
@@ -1720,6 +1726,22 @@ export function lastSecondOf(stored) {
1720
1726
  ? seconds + span - 1
1721
1727
  : next.getTime() / 1000 - 1;
1722
1728
  }
1729
+ /** A range bound as stored: a `date` or `period` bound, ISO 8601 at the edge,
1730
+ * becomes Unix seconds ({@link isoToUnixSeconds}) – a `min` the first second
1731
+ * of what it names, a `max` the last ({@link lastSecondOf}), so the range
1732
+ * takes in the whole of each. Any other bound is stored as given; one the
1733
+ * codec cannot read is `undefined`. */
1734
+ export function storedRangeBound(field, bound, side) {
1735
+ if ((field.kind !== 'date' && field.kind !== 'period') ||
1736
+ typeof bound !== 'string') {
1737
+ return bound;
1738
+ }
1739
+ const stored = isoToUnixSeconds(bound);
1740
+ if (stored === undefined) {
1741
+ return undefined;
1742
+ }
1743
+ return side === 'min' ? stored.seconds : lastSecondOf(stored);
1744
+ }
1723
1745
  /** `seconds` if a `date` field can store it – the int64 the engine keeps
1724
1746
  * Unix seconds in – or `undefined`, the same answer {@link isoToUnixSeconds}
1725
1747
  * gives a string it cannot parse. */
@@ -1832,6 +1854,7 @@ export function physicalFields(field, schema) {
1832
1854
  facet: undefined,
1833
1855
  identity: undefined,
1834
1856
  precision: undefined,
1857
+ period: undefined,
1835
1858
  };
1836
1859
  }
1837
1860
  // A field storing a nested OBJECT cannot be filtered or faceted as itself, so
@@ -1855,8 +1878,17 @@ export function physicalFields(field, schema) {
1855
1878
  : `${filtered}_facet`,
1856
1879
  identity,
1857
1880
  precision: field.kind === 'date' ? `${field.name}_precision` : undefined,
1881
+ period: field.kind === 'period'
1882
+ ? { start: `${field.name}_start`, end: `${field.name}_end` }
1883
+ : undefined,
1858
1884
  };
1859
1885
  }
1886
+ /** The value companions a field stores beside its own name: a `date`’s
1887
+ * precision, a `period`’s two bounds. */
1888
+ export function companionNames(field) {
1889
+ const { precision, period } = physicalFields(field);
1890
+ return [precision, period?.start, period?.end].filter((name) => name !== undefined);
1891
+ }
1860
1892
  /**
1861
1893
  * The {@link FacetKeys facet policies} a field inherits, keyed by the `name` of
1862
1894
  * the Root Type declaring each: the `facetKeys` of every type the field names
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/search",
3
- "version": "0.36.4",
3
+ "version": "0.38.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",