@lde/search-pipeline 0.6.0 → 0.7.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.
Files changed (2) hide show
  1. package/README.md +24 -6
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -60,9 +60,6 @@ const schema = searchSchema(
60
60
  },
61
61
  );
62
62
 
63
- // Each type maps to its own collection: an independent blue/green rebuild.
64
- const collectionName = { Dataset: 'datasets', Organization: 'organizations' };
65
-
66
63
  const pipeline = new Pipeline({
67
64
  datasetSelector,
68
65
  stages: [
@@ -71,18 +68,39 @@ const pipeline = new Pipeline({
71
68
  readers: new SparqlConstructReader({ query: '…' }),
72
69
  }),
73
70
  ],
71
+ // Each type gets its own collection – an independent blue/green rebuild –
72
+ // named by the adapter from the type itself (`Dataset` → `datasets`,
73
+ // `Organization` → `organizations`), so no naming map is passed here and the
74
+ // engine reading these collections cannot disagree about where they are.
74
75
  writers: searchIndexWriter({
75
76
  schema,
76
77
  writerFor: (searchType) =>
77
- new BlueGreenRebuild(typesenseClient, searchType, {
78
- name: collectionName[searchType.name],
79
- }),
78
+ new BlueGreenRebuild(typesenseClient, searchType),
80
79
  }),
81
80
  });
82
81
 
83
82
  await pipeline.run();
84
83
  ```
85
84
 
85
+ Collection names are the engine adapter’s to decide, not this package’s – see
86
+ [Collection naming](../search-typesense#collection-naming). A deployment that
87
+ needs other names passes one per type, and environment prefixing **composes
88
+ with** the convention rather than replacing it, since the adapter exports the
89
+ derivation:
90
+
91
+ ```ts
92
+ import { BlueGreenRebuild, deriveCollectionName } from '@lde/search-typesense';
93
+
94
+ writerFor: (searchType) =>
95
+ new BlueGreenRebuild(typesenseClient, searchType, {
96
+ name: `${process.env.INDEX_PREFIX}_${deriveCollectionName(searchType)}`,
97
+ });
98
+ ```
99
+
100
+ Whatever the writers are named, the engine reading these collections must be
101
+ given the same names (`collections`), or it reads the derived ones and finds an
102
+ empty index.
103
+
86
104
  Each dataset’s extracted CONSTRUCT quads are buffered until the dataset
87
105
  completes, then projected once over the **whole** schema (`@lde/search`’s
88
106
  `projectGraph`) into one mixed, type-tagged stream, and each document is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/search-pipeline",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Search indexing as an @lde/pipeline instance: a Writer<Quad> that applies the @lde/search projection to extracted RDF and fans each document out to the transactional engine writer for its type's collection. Glue between the pipeline quad world and the search-engine document world; owns no projection or engine logic itself.",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/ldelements/lde.git",
@@ -25,12 +25,12 @@
25
25
  "!**/*.tsbuildinfo"
26
26
  ],
27
27
  "dependencies": {
28
- "@lde/search": "^0.7.0",
28
+ "@lde/search": "^0.8.0",
29
29
  "@rdfjs/types": "^2.0.1",
30
30
  "tslib": "^2.3.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@lde/search-typesense": "^0.9.0",
33
+ "@lde/search-typesense": "^0.10.0",
34
34
  "n3": "^2.1.1",
35
35
  "testcontainers": "^12.0.3",
36
36
  "typesense": "^3.0.6"