@pod-os/core 0.9.1-b894ee0.0 → 0.9.1-dde7d37.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/index.js CHANGED
@@ -37979,6 +37979,7 @@ var SearchIndex = class {
37979
37979
  constructor(indexes) {
37980
37980
  this.index = (0, import_lunr.default)(function() {
37981
37981
  this.ref("uri");
37982
+ this.field("uri");
37982
37983
  this.field("label");
37983
37984
  this.metadataWhitelist = ["position"];
37984
37985
  const items2 = indexes.flatMap((it) => it.getIndexedItems());
@@ -37990,8 +37991,15 @@ var SearchIndex = class {
37990
37991
  });
37991
37992
  });
37992
37993
  }
37993
- search(query4) {
37994
- return this.index.search("*" + query4 + "*");
37994
+ search(term3) {
37995
+ const escapedTerm = term3.replace(/[~^+:]/g, (x) => `\\${x}`);
37996
+ return this.index.search(
37997
+ `${escapedTerm}^100 ${escapedTerm}*^20 *${escapedTerm}^10 *${escapedTerm}*^5`
37998
+ );
37999
+ }
38000
+ clear() {
38001
+ this.index = (0, import_lunr.default)(() => {
38002
+ });
37995
38003
  }
37996
38004
  };
37997
38005
 
package/lib/index.js CHANGED
@@ -46413,6 +46413,7 @@ var PodOS = (() => {
46413
46413
  constructor(indexes) {
46414
46414
  this.index = (0, import_lunr.default)(function() {
46415
46415
  this.ref("uri");
46416
+ this.field("uri");
46416
46417
  this.field("label");
46417
46418
  this.metadataWhitelist = ["position"];
46418
46419
  const items2 = indexes.flatMap((it) => it.getIndexedItems());
@@ -46424,8 +46425,15 @@ var PodOS = (() => {
46424
46425
  });
46425
46426
  });
46426
46427
  }
46427
- search(query4) {
46428
- return this.index.search("*" + query4 + "*");
46428
+ search(term3) {
46429
+ const escapedTerm = term3.replace(/[~^+:]/g, (x) => `\\${x}`);
46430
+ return this.index.search(
46431
+ `${escapedTerm}^100 ${escapedTerm}*^20 *${escapedTerm}^10 *${escapedTerm}*^5`
46432
+ );
46433
+ }
46434
+ clear() {
46435
+ this.index = (0, import_lunr.default)(() => {
46436
+ });
46429
46437
  }
46430
46438
  };
46431
46439
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pod-os/core",
3
- "version": "0.9.1-b894ee0.0",
3
+ "version": "0.9.1-dde7d37.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./types/index.d.ts",
6
6
  "files": [
@@ -3,5 +3,6 @@ import { Index } from "lunr";
3
3
  export declare class SearchIndex {
4
4
  private index;
5
5
  constructor(indexes: LabelIndex[]);
6
- search(query: string): Index.Result[];
6
+ search(term: string): Index.Result[];
7
+ clear(): void;
7
8
  }