@lde/search-typesense 0.4.1 → 0.4.3

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 CHANGED
@@ -17,6 +17,15 @@ type comes from each field’s `kind`, and the physical fanout (per-locale
17
17
  search/sort keys) matches what the projection writes, via
18
18
  `@lde/search`’s `physicalFields`, so the index and the documents cannot drift.
19
19
 
20
+ **Memory lever.** Typesense keeps the index in RAM (with a raw copy of each
21
+ document on disk), so RAM tracks the _indexed_ surface – roughly 2–3× the size
22
+ of the fields you search, facet or sort on – not the full document.
23
+ `buildCollectionSchema` keeps that surface minimal: the `output` display labels
24
+ fan out to `index: false` fields, stored on disk and fetched only for a hit, so
25
+ they cost no RAM; only the folded `*_search_${locale}`, facet/reference and
26
+ `*_sort_${locale}` companions are indexed. Keeping retrieval-only fields
27
+ un-indexed is the lever for holding a large index’s RAM down.
28
+
20
29
  `createTypesenseSearchEngine(client, { collection, labelsCollection })` is the
21
30
  `SearchEngine` implementation. Each search:
22
31
 
@@ -25,6 +25,15 @@ export interface CollectionSchemaOptions {
25
25
  * untagged `und` locale (and any searchable keyword/reference companion)
26
26
  * stems in `defaultLocale` when one is set, and is left unstemmed (folded
27
27
  * only) otherwise.
28
+ *
29
+ * Memory lever: Typesense holds the index in RAM (with a raw copy of each
30
+ * document on disk), so RAM tracks the *indexed* surface – roughly 2–3× the
31
+ * size of the fields you search, facet or sort on – not the whole document.
32
+ * This builder keeps that surface minimal: the `output` display labels fan out
33
+ * to `index: false` fields, kept on disk and read back only for a hit, so they
34
+ * cost no RAM; only the folded `*_search_${locale}`, facet/reference and
35
+ * `*_sort_${locale}` companions are indexed. Keeping retrieval-only fields
36
+ * un-indexed is the lever for holding a large index’s RAM down.
28
37
  */
29
38
  export declare function buildCollectionSchema(searchType: SearchType, options: CollectionSchemaOptions): CollectionCreateSchema;
30
39
  //# sourceMappingURL=collection-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collection-schema.d.ts","sourceRoot":"","sources":["../src/collection-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAGhE,0EAA0E;AAC1E,MAAM,WAAW,uBAAuB;IACtC,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;4BAGwB;IACxB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,kEAAkE;IAClE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,kEAAkE;IAClE,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,uBAAuB,GAC/B,sBAAsB,CAexB"}
1
+ {"version":3,"file":"collection-schema.d.ts","sourceRoot":"","sources":["../src/collection-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAGhE,0EAA0E;AAC1E,MAAM,WAAW,uBAAuB;IACtC,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;4BAGwB;IACxB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,kEAAkE;IAClE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,kEAAkE;IAClE,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,uBAAuB,GAC/B,sBAAsB,CAexB"}
@@ -10,6 +10,15 @@ import { physicalFields } from '@lde/search/adapter';
10
10
  * untagged `und` locale (and any searchable keyword/reference companion)
11
11
  * stems in `defaultLocale` when one is set, and is left unstemmed (folded
12
12
  * only) otherwise.
13
+ *
14
+ * Memory lever: Typesense holds the index in RAM (with a raw copy of each
15
+ * document on disk), so RAM tracks the *indexed* surface – roughly 2–3× the
16
+ * size of the fields you search, facet or sort on – not the whole document.
17
+ * This builder keeps that surface minimal: the `output` display labels fan out
18
+ * to `index: false` fields, kept on disk and read back only for a hit, so they
19
+ * cost no RAM; only the folded `*_search_${locale}`, facet/reference and
20
+ * `*_sort_${locale}` companions are indexed. Keeping retrieval-only fields
21
+ * un-indexed is the lever for holding a large index’s RAM down.
13
22
  */
14
23
  export function buildCollectionSchema(searchType, options) {
15
24
  const { defaultLocale } = options;
@@ -31,8 +40,10 @@ function typesenseFields(field, defaultLocale, defaultSortingField) {
31
40
  if (field.kind === 'text') {
32
41
  const locales = field.locales;
33
42
  return [
34
- // Display labels: stored, not indexed for search (search uses the folded
35
- // companions), accents preserved.
43
+ // Display labels: stored but NOT indexed (`index: false`) – search hits
44
+ // the folded `*_search` companions, so the display copy stays on disk and
45
+ // off RAM (fetched only for a hit), accents preserved. This is the memory
46
+ // lever: RAM tracks the search surface, not the display text.
36
47
  ...names.display.map((name) => ({
37
48
  name,
38
49
  type: 'string',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/search-typesense",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Typesense implementation of the @lde/search SearchEngine port: collection-schema builder, query compiler, label-resolving result reconstruction, and blue/green index lifecycle. Engine-specific (Typesense) but domain-agnostic.",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/ldelements/lde.git",
@@ -25,7 +25,7 @@
25
25
  "!**/*.tsbuildinfo"
26
26
  ],
27
27
  "dependencies": {
28
- "@lde/search": "^0.3.0",
28
+ "@lde/search": "^0.3.1",
29
29
  "@lde/text-normalization": "^0.1.1",
30
30
  "tslib": "^2.3.0",
31
31
  "typesense": "^3.0.6"
@@ -35,6 +35,6 @@
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@lde/dataset": "^0.7.8",
38
- "@lde/pipeline": "^0.33.1"
38
+ "@lde/pipeline": "^0.33.3"
39
39
  }
40
40
  }