@verdaccio/search 6.0.0-6-next.2 → 7.0.0-next.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 (3) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/dist.js +1103 -2647
  3. package/package.json +3 -4
package/build/dist.js CHANGED
@@ -322,8 +322,8 @@ var require_common = __commonJS({
322
322
  var require_browser = __commonJS({
323
323
  "../../node_modules/.pnpm/debug@4.3.4_supports-color@6.1.0/node_modules/debug/src/browser.js"(exports, module2) {
324
324
  exports.formatArgs = formatArgs;
325
- exports.save = save3;
326
- exports.load = load3;
325
+ exports.save = save5;
326
+ exports.load = load5;
327
327
  exports.useColors = useColors;
328
328
  exports.storage = localstorage();
329
329
  exports.destroy = (() => {
@@ -444,7 +444,7 @@ var require_browser = __commonJS({
444
444
  }
445
445
  exports.log = console.debug || console.log || (() => {
446
446
  });
447
- function save3(namespaces) {
447
+ function save5(namespaces) {
448
448
  try {
449
449
  if (namespaces) {
450
450
  exports.storage.setItem("debug", namespaces);
@@ -454,7 +454,7 @@ var require_browser = __commonJS({
454
454
  } catch (error) {
455
455
  }
456
456
  }
457
- function load3() {
457
+ function load5() {
458
458
  let r;
459
459
  try {
460
460
  r = exports.storage.getItem("debug");
@@ -606,8 +606,8 @@ var require_node = __commonJS({
606
606
  exports.init = init;
607
607
  exports.log = log;
608
608
  exports.formatArgs = formatArgs;
609
- exports.save = save3;
610
- exports.load = load3;
609
+ exports.save = save5;
610
+ exports.load = load5;
611
611
  exports.useColors = useColors;
612
612
  exports.destroy = util.deprecate(() => {
613
613
  }, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
@@ -739,14 +739,14 @@ var require_node = __commonJS({
739
739
  function log(...args) {
740
740
  return process.stderr.write(util.format(...args) + "\n");
741
741
  }
742
- function save3(namespaces) {
742
+ function save5(namespaces) {
743
743
  if (namespaces) {
744
744
  process.env.DEBUG = namespaces;
745
745
  } else {
746
746
  delete process.env.DEBUG;
747
747
  }
748
748
  }
749
- function load3() {
749
+ function load5() {
750
750
  return process.env.DEBUG;
751
751
  }
752
752
  function init(debug2) {
@@ -786,7 +786,7 @@ __export(src_exports, {
786
786
  SearchMemoryIndexer: () => indexer_default
787
787
  });
788
788
 
789
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/languages.js
789
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/tokenizer/languages.js
790
790
  var STEMMERS = {
791
791
  arabic: "ar",
792
792
  armenian: "am",
@@ -813,6 +813,7 @@ var STEMMERS = {
813
813
  slovenian: "ru",
814
814
  spanish: "es",
815
815
  swedish: "se",
816
+ tamil: "ta",
816
817
  turkish: "tr",
817
818
  ukrainian: "uk"
818
819
  };
@@ -843,11 +844,12 @@ var SPLITTERS = {
843
844
  indonesian: /[^a-z0-9]+/gim,
844
845
  ukrainian: /[^a-z0-9а-яА-ЯіїєІЇЄ]+/gim,
845
846
  slovenian: /[^a-z0-9螚ȎŠ]+/gim,
846
- bulgarian: /[^a-z0-9а-яА-Я]+/gim
847
+ bulgarian: /[^a-z0-9а-яА-Я]+/gim,
848
+ tamil: /[^a-z0-9அ-ஹ]+/gim
847
849
  };
848
850
  var SUPPORTED_LANGUAGES = Object.keys(STEMMERS);
849
851
 
850
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/utils.js
852
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/utils.js
851
853
  var baseId = Date.now().toString().slice(5);
852
854
  var lastId = 0;
853
855
  var nano = BigInt(1e3);
@@ -902,9 +904,6 @@ async function getNanosecondsTime() {
902
904
  async function uniqueId() {
903
905
  return `${baseId}-${lastId++}`;
904
906
  }
905
- function syncUniqueId() {
906
- return `${baseId}-${lastId++}`;
907
- }
908
907
  function getOwnProperty(object, property) {
909
908
  if (Object.hasOwn === void 0) {
910
909
  return Object.prototype.hasOwnProperty.call(object, property) ? object[property] : void 0;
@@ -913,7 +912,7 @@ function getOwnProperty(object, property) {
913
912
  }
914
913
  function sortTokenScorePredicate(a, b) {
915
914
  if (b[1] === a[1]) {
916
- return a[0].localeCompare(b[0]);
915
+ return a[0] - b[0];
917
916
  }
918
917
  return b[1] - a[1];
919
918
  }
@@ -963,7 +962,7 @@ async function getDocumentProperties(doc, paths) {
963
962
  const pathTokensLength = pathTokens.length;
964
963
  for (let j = 0; j < pathTokensLength; j++) {
965
964
  current = current[pathTokens[j]];
966
- if (typeof current === "object" && current !== null && j === pathTokensLength - 1) {
965
+ if (typeof current === "object" && !Array.isArray(current) && current !== null && j === pathTokensLength - 1) {
967
966
  current = void 0;
968
967
  break;
969
968
  } else if ((current === null || typeof current !== "object") && j < pathTokensLength - 1) {
@@ -984,7 +983,7 @@ async function getNested(obj, path) {
984
983
  return props[path];
985
984
  }
986
985
 
987
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/errors.js
986
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/errors.js
988
987
  var allLanguages = SUPPORTED_LANGUAGES.join("\n - ");
989
988
  var errors = {
990
989
  NO_LANGUAGE_WITH_CUSTOM_TOKENIZER: "Do not pass the language option to create when using a custom tokenizer.",
@@ -997,7 +996,7 @@ Supported languages are:
997
996
  UNSUPPORTED_COMPONENT: `Unsupported component "%s".`,
998
997
  COMPONENT_MUST_BE_FUNCTION: `The component "%s" must be a function.`,
999
998
  COMPONENT_MUST_BE_FUNCTION_OR_ARRAY_FUNCTIONS: `The component "%s" must be a function or an array of functions.`,
1000
- INVALID_SCHEMA_TYPE: `Unsupported schema type "%s". Expected "string", "boolean" or "number".`,
999
+ INVALID_SCHEMA_TYPE: `Unsupported schema type "%s" at "%s". Expected "string", "boolean" or "number" or array of them.`,
1001
1000
  DOCUMENT_ID_MUST_BE_STRING: `Document id must be of type "string". Got "%s" instead.`,
1002
1001
  DOCUMENT_ALREADY_EXISTS: `A document with id "%s" already exists.`,
1003
1002
  DOCUMENT_DOES_NOT_EXIST: `A document with id "%s" does not exists.`,
@@ -1005,7 +1004,15 @@ Supported languages are:
1005
1004
  INVALID_DOCUMENT_PROPERTY: `Invalid document property "%s": expected "%s", got "%s"`,
1006
1005
  UNKNOWN_INDEX: `Invalid property name "%s". Expected a wildcard string ("*") or array containing one of the following properties: %s`,
1007
1006
  INVALID_BOOST_VALUE: `Boost value must be a number greater than, or less than 0.`,
1008
- INVALID_FILTER_OPERATION: `You can only use one operation per filter, you requested %d.`
1007
+ INVALID_FILTER_OPERATION: `You can only use one operation per filter, you requested %d.`,
1008
+ SCHEMA_VALIDATION_FAILURE: `Cannot insert document due schema validation failure on "%s" property.`,
1009
+ INVALID_SORT_SCHEMA_TYPE: `Unsupported sort schema type "%s" at "%s". Expected "string" or "number".`,
1010
+ CANNOT_SORT_BY_ARRAY: `Cannot configure sort for "%s" because it is an array (%s).`,
1011
+ UNABLE_TO_SORT_ON_UNKNOWN_FIELD: `Unable to sort on unknown field "%s". Allowed fields: %s`,
1012
+ SORT_DISABLED: `Sort is disabled. Please read the documentation at https://docs.oramasearch for more information.`,
1013
+ UNKNOWN_GROUP_BY_PROPERTY: `Unknown groupBy property "%s".`,
1014
+ INVALID_GROUP_BY_PROPERTY: `Invalid groupBy property "%s". Allowed types: "%s", but given "%s".`,
1015
+ UNKNOWN_FILTER_PROPERTY: `Unknown filter property "%s".`
1009
1016
  };
1010
1017
  function createError(code, ...args) {
1011
1018
  var _a2;
@@ -1017,7 +1024,7 @@ function createError(code, ...args) {
1017
1024
  return error;
1018
1025
  }
1019
1026
 
1020
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/defaults.js
1027
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/defaults.js
1021
1028
  async function formatElapsedTime(n) {
1022
1029
  return {
1023
1030
  raw: Number(n),
@@ -1035,37 +1042,126 @@ async function getDocumentIndexId(doc) {
1035
1042
  }
1036
1043
  async function validateSchema(doc, schema) {
1037
1044
  for (const [prop, type] of Object.entries(schema)) {
1038
- if (typeof type === "object") {
1039
- if (!doc[prop] || typeof doc[prop] !== "object" && Array.isArray(doc[prop])) {
1040
- return false;
1045
+ const value = doc[prop];
1046
+ const typeOfValue = typeof value;
1047
+ if (typeOfValue === "undefined") {
1048
+ continue;
1049
+ }
1050
+ const typeOfType = typeof type;
1051
+ if (typeOfType === "string" && isArrayType(type)) {
1052
+ if (!Array.isArray(value)) {
1053
+ return prop;
1041
1054
  }
1042
- if (!validateSchema(doc[prop], type)) {
1043
- return false;
1055
+ const expectedType = getInnerType(type);
1056
+ const valueLength = value.length;
1057
+ for (let i = 0; i < valueLength; i++) {
1058
+ if (typeof value[i] !== expectedType) {
1059
+ return prop + "." + i;
1060
+ }
1044
1061
  }
1062
+ continue;
1045
1063
  }
1046
- if (typeof doc[prop] !== type) {
1047
- return false;
1064
+ if (typeOfType === "object") {
1065
+ if (!value || typeOfValue !== "object") {
1066
+ return prop;
1067
+ }
1068
+ const subProp = await validateSchema(value, type);
1069
+ if (subProp) {
1070
+ return prop + "." + subProp;
1071
+ }
1072
+ continue;
1073
+ }
1074
+ if (typeOfValue !== type) {
1075
+ return prop;
1048
1076
  }
1049
1077
  }
1050
- return true;
1078
+ return void 0;
1079
+ }
1080
+ var IS_ARRAY_TYPE = {
1081
+ string: false,
1082
+ number: false,
1083
+ boolean: false,
1084
+ "string[]": true,
1085
+ "number[]": true,
1086
+ "boolean[]": true
1087
+ };
1088
+ var INNER_TYPE = {
1089
+ "string[]": "string",
1090
+ "number[]": "number",
1091
+ "boolean[]": "boolean"
1092
+ };
1093
+ function isArrayType(type) {
1094
+ return IS_ARRAY_TYPE[type];
1095
+ }
1096
+ function getInnerType(type) {
1097
+ return INNER_TYPE[type];
1051
1098
  }
1052
1099
 
1053
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/documents-store.js
1054
- async function create() {
1100
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/internal-document-id-store.js
1101
+ function createInternalDocumentIDStore() {
1102
+ return {
1103
+ idToInternalId: /* @__PURE__ */ new Map(),
1104
+ internalIdToId: [],
1105
+ save,
1106
+ load
1107
+ };
1108
+ }
1109
+ function save(store2) {
1055
1110
  return {
1111
+ internalIdToId: store2.internalIdToId
1112
+ };
1113
+ }
1114
+ function load(orama, raw) {
1115
+ const { internalIdToId } = raw;
1116
+ orama.internalDocumentIDStore.idToInternalId.clear();
1117
+ orama.internalDocumentIDStore.internalIdToId = [];
1118
+ for (let i = 0; i < internalIdToId.length; i++) {
1119
+ orama.internalDocumentIDStore.idToInternalId.set(internalIdToId[i], i + 1);
1120
+ orama.internalDocumentIDStore.internalIdToId.push(internalIdToId[i]);
1121
+ }
1122
+ }
1123
+ function getInternalDocumentId(store2, id) {
1124
+ if (typeof id === "string") {
1125
+ const internalId = store2.idToInternalId.get(id);
1126
+ if (internalId) {
1127
+ return internalId;
1128
+ }
1129
+ const currentId = store2.idToInternalId.size + 1;
1130
+ store2.idToInternalId.set(id, currentId);
1131
+ store2.internalIdToId.push(id);
1132
+ return currentId;
1133
+ }
1134
+ if (id > store2.internalIdToId.length) {
1135
+ return getInternalDocumentId(store2, id.toString());
1136
+ }
1137
+ return id;
1138
+ }
1139
+ function getDocumentIdFromInternalId(store2, internalId) {
1140
+ if (store2.internalIdToId.length < internalId) {
1141
+ throw new Error(`Invalid internalId ${internalId}`);
1142
+ }
1143
+ return store2.internalIdToId[internalId - 1];
1144
+ }
1145
+
1146
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/documents-store.js
1147
+ async function create(_, sharedInternalDocumentStore) {
1148
+ return {
1149
+ sharedInternalDocumentStore,
1056
1150
  docs: {},
1057
1151
  count: 0
1058
1152
  };
1059
1153
  }
1060
1154
  async function get(store2, id) {
1061
- return store2.docs[id];
1155
+ const internalId = getInternalDocumentId(store2.sharedInternalDocumentStore, id);
1156
+ return store2.docs[internalId];
1062
1157
  }
1063
1158
  async function getMultiple(store2, ids) {
1064
1159
  const found = Array.from({
1065
1160
  length: ids.length
1066
1161
  });
1067
1162
  for (let i = 0; i < ids.length; i++) {
1068
- found[i] = store2.docs[ids[i]];
1163
+ const internalId = getInternalDocumentId(store2.sharedInternalDocumentStore, ids[i]);
1164
+ found[i] = store2.docs[internalId];
1069
1165
  }
1070
1166
  return found;
1071
1167
  }
@@ -1073,35 +1169,38 @@ async function getAll(store2) {
1073
1169
  return store2.docs;
1074
1170
  }
1075
1171
  async function store(store2, id, doc) {
1076
- if (typeof store2.docs[id] !== "undefined") {
1172
+ const internalId = getInternalDocumentId(store2.sharedInternalDocumentStore, id);
1173
+ if (typeof store2.docs[internalId] !== "undefined") {
1077
1174
  return false;
1078
1175
  }
1079
- store2.docs[id] = doc;
1176
+ store2.docs[internalId] = doc;
1080
1177
  store2.count++;
1081
1178
  return true;
1082
1179
  }
1083
1180
  async function remove(store2, id) {
1084
- if (typeof store2.docs[id] === "undefined") {
1181
+ const internalId = getInternalDocumentId(store2.sharedInternalDocumentStore, id);
1182
+ if (typeof store2.docs[internalId] === "undefined") {
1085
1183
  return false;
1086
1184
  }
1087
- store2.docs[id] = void 0;
1185
+ delete store2.docs[internalId];
1088
1186
  store2.count--;
1089
1187
  return true;
1090
1188
  }
1091
1189
  async function count(store2) {
1092
1190
  return store2.count;
1093
1191
  }
1094
- async function load(raw) {
1192
+ async function load2(sharedInternalDocumentStore, raw) {
1095
1193
  const rawDocument = raw;
1096
1194
  return {
1097
1195
  docs: rawDocument.docs,
1098
- count: rawDocument.count
1196
+ count: rawDocument.count,
1197
+ sharedInternalDocumentStore
1099
1198
  };
1100
1199
  }
1101
- async function save(docs) {
1200
+ async function save2(store2) {
1102
1201
  return {
1103
- docs: docs.docs,
1104
- count: docs.count
1202
+ docs: store2.docs,
1203
+ count: store2.count
1105
1204
  };
1106
1205
  }
1107
1206
  async function createDocumentsStore() {
@@ -1113,16 +1212,17 @@ async function createDocumentsStore() {
1113
1212
  store,
1114
1213
  remove,
1115
1214
  count,
1116
- load,
1117
- save
1215
+ load: load2,
1216
+ save: save2
1118
1217
  };
1119
1218
  }
1120
1219
 
1121
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/hooks.js
1220
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/hooks.js
1122
1221
  var OBJECT_COMPONENTS = [
1123
1222
  "tokenizer",
1124
1223
  "index",
1125
- "documentsStore"
1224
+ "documentsStore",
1225
+ "sorter"
1126
1226
  ];
1127
1227
  var FUNCTION_COMPONENTS = [
1128
1228
  "validateSchema",
@@ -1137,6 +1237,7 @@ var SINGLE_OR_ARRAY_COMPONENTS = [
1137
1237
  "afterRemove",
1138
1238
  "beforeUpdate",
1139
1239
  "afterUpdate",
1240
+ "afterSearch",
1140
1241
  "beforeMultipleInsert",
1141
1242
  "afterMultipleInsert",
1142
1243
  "beforeMultipleRemove",
@@ -1145,34 +1246,26 @@ var SINGLE_OR_ARRAY_COMPONENTS = [
1145
1246
  "afterMultipleUpdate"
1146
1247
  ];
1147
1248
  async function runSingleHook(hooks, orama, id, doc) {
1148
- for (let i = 0; i < hooks.length; i++) {
1249
+ const hooksLength = hooks.length;
1250
+ for (let i = 0; i < hooksLength; i++) {
1149
1251
  await hooks[i](orama, id, doc);
1150
1252
  }
1151
1253
  }
1254
+ async function runAfterSearch(hooks, db, params, language, results) {
1255
+ const hooksLength = hooks.length;
1256
+ for (let i = 0; i < hooksLength; i++) {
1257
+ await hooks[i](db, params, language, results);
1258
+ }
1259
+ }
1152
1260
 
1153
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/trees/avl.js
1261
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/trees/avl.js
1154
1262
  var BALANCE_STATE = {
1155
- UNBALANCED_RIGHT: 1,
1156
- SLIGHTLY_UNBALANCED_RIGHT: 2,
1157
- BALANCED: 3,
1158
- SLIGHTLY_UNBALANCED_LEFT: 4,
1159
- UNBALANCED_LEFT: 5
1263
+ UNBALANCED_RIGHT: -2,
1264
+ SLIGHTLY_UNBALANCED_RIGHT: -1,
1265
+ BALANCED: 0,
1266
+ SLIGHTLY_UNBALANCED_LEFT: 1,
1267
+ UNBALANCED_LEFT: 2
1160
1268
  };
1161
- function getBalanceFactor(node) {
1162
- const heightDifference = getHeight(node.left) - getHeight(node.right);
1163
- switch (heightDifference) {
1164
- case -2:
1165
- return BALANCE_STATE.UNBALANCED_RIGHT;
1166
- case -1:
1167
- return BALANCE_STATE.SLIGHTLY_UNBALANCED_RIGHT;
1168
- case 1:
1169
- return BALANCE_STATE.SLIGHTLY_UNBALANCED_LEFT;
1170
- case 2:
1171
- return BALANCE_STATE.UNBALANCED_LEFT;
1172
- default:
1173
- return BALANCE_STATE.BALANCED;
1174
- }
1175
- }
1176
1269
  function getHeight(node) {
1177
1270
  return node ? node.height : -1;
1178
1271
  }
@@ -1192,9 +1285,6 @@ function rotateRight(node) {
1192
1285
  left.height = Math.max(getHeight(left.left), getHeight(left.right)) + 1;
1193
1286
  return left;
1194
1287
  }
1195
- function findMin(node) {
1196
- return node.left ? findMin(node.left) : node;
1197
- }
1198
1288
  function rangeSearch(node, min, max) {
1199
1289
  if (!node) {
1200
1290
  return [];
@@ -1260,16 +1350,16 @@ function lessThan(node, key, inclusive = false) {
1260
1350
  return result;
1261
1351
  }
1262
1352
  function getNodeByKey(node, key) {
1263
- if (!node) {
1264
- return null;
1265
- }
1266
- if (node.key === key) {
1267
- return node;
1268
- }
1269
- if (key < node.key) {
1270
- return node.left ? getNodeByKey(node.left, key) : null;
1353
+ while (node !== null) {
1354
+ if (key < node.key) {
1355
+ node = node.left;
1356
+ } else if (key > node.key) {
1357
+ node = node.right;
1358
+ } else {
1359
+ return node;
1360
+ }
1271
1361
  }
1272
- return node.right ? getNodeByKey(node.right, key) : null;
1362
+ return null;
1273
1363
  }
1274
1364
  function create2(key, value) {
1275
1365
  return {
@@ -1280,93 +1370,124 @@ function create2(key, value) {
1280
1370
  height: 0
1281
1371
  };
1282
1372
  }
1283
- function insert(node, key, value) {
1284
- if (!node) {
1285
- return create2(key, value);
1373
+ function insert(root, key, value) {
1374
+ let parent = null;
1375
+ let current = root;
1376
+ while (current !== null) {
1377
+ parent = current;
1378
+ if (key < current.key) {
1379
+ current = current.left;
1380
+ } else if (key > current.key) {
1381
+ current = current.right;
1382
+ } else {
1383
+ current.value = current.value.concat(value);
1384
+ return root;
1385
+ }
1286
1386
  }
1287
- if (key < node.key) {
1288
- node.left = insert(node.left, key, value);
1289
- } else if (key > node.key) {
1290
- node.right = insert(node.right, key, value);
1387
+ const newNode = create2(key, value);
1388
+ if (!parent) {
1389
+ root = newNode;
1390
+ } else if (key < parent.key) {
1391
+ parent.left = newNode;
1291
1392
  } else {
1292
- node.value = node.value.concat(value);
1293
- return node;
1393
+ parent.right = newNode;
1294
1394
  }
1295
- const balanceFactor = getBalanceFactor(node);
1296
- if (balanceFactor === BALANCE_STATE.UNBALANCED_LEFT) {
1297
- if (key < node.left.key) {
1298
- node = rotateRight(node);
1299
- } else {
1300
- node.left = rotateLeft(node.left);
1301
- node = rotateRight(node);
1395
+ current = newNode;
1396
+ while (parent) {
1397
+ const balanceFactor = getHeight(parent.left) - getHeight(parent.right);
1398
+ if (balanceFactor === BALANCE_STATE.UNBALANCED_LEFT) {
1399
+ if (key > parent.left.key) {
1400
+ parent.left = rotateLeft(parent.left);
1401
+ }
1402
+ parent = rotateRight(parent);
1302
1403
  }
1404
+ if (balanceFactor === BALANCE_STATE.UNBALANCED_RIGHT) {
1405
+ if (key < parent.right.key) {
1406
+ parent.right = rotateRight(parent.right);
1407
+ }
1408
+ parent = rotateLeft(parent);
1409
+ }
1410
+ if (parent === root) {
1411
+ break;
1412
+ }
1413
+ current = parent;
1414
+ parent = getNodeParent(root, current.key);
1303
1415
  }
1304
- if (balanceFactor === BALANCE_STATE.UNBALANCED_RIGHT) {
1305
- if (key > node.right.key) {
1306
- node = rotateLeft(node);
1416
+ return root;
1417
+ }
1418
+ function getNodeParent(root, key) {
1419
+ let current = root;
1420
+ let parent = null;
1421
+ while (current !== null) {
1422
+ if (key < current.key) {
1423
+ parent = current;
1424
+ current = current.left;
1425
+ } else if (key > current.key) {
1426
+ parent = current;
1427
+ current = current.right;
1307
1428
  } else {
1308
- node.right = rotateRight(node.right);
1309
- node = rotateLeft(node);
1429
+ break;
1310
1430
  }
1311
1431
  }
1312
- return node;
1432
+ return parent;
1313
1433
  }
1314
- function find(node, key) {
1434
+ function find(root, key) {
1435
+ const node = getNodeByKey(root, key);
1315
1436
  if (!node) {
1316
1437
  return null;
1317
1438
  }
1318
- if (node.key === key) {
1319
- return node.value;
1320
- }
1321
- if (key < node.key) {
1322
- return node.left ? find(node.left, key) : null;
1323
- }
1324
- return node.right ? find(node.right, key) : null;
1439
+ return node.value;
1325
1440
  }
1326
- function remove2(node, key) {
1441
+ function remove2(root, key) {
1442
+ let node = root;
1443
+ let parentNode = null;
1444
+ while (node && node.key !== key) {
1445
+ parentNode = node;
1446
+ if (key < node.key) {
1447
+ node = node.left;
1448
+ } else {
1449
+ node = node.right;
1450
+ }
1451
+ }
1327
1452
  if (!node) {
1328
1453
  return null;
1329
1454
  }
1330
- if (key < node.key) {
1331
- node.left = remove2(node.left, key);
1332
- } else if (key > node.key) {
1333
- node.right = remove2(node.right, key);
1334
- } else {
1335
- if (!node.left && !node.right) {
1336
- return null;
1337
- }
1338
- if (!node.left) {
1339
- return node.right;
1340
- }
1341
- if (!node.right) {
1342
- return node.left;
1343
- }
1344
- const temp = findMin(node.right);
1345
- node.key = temp.key;
1346
- node.right = remove2(node.right, temp.key);
1347
- }
1348
- const balanceFactor = getBalanceFactor(node);
1349
- const leftNode = node.left;
1350
- const rightNode = node.right;
1351
- if (balanceFactor === BALANCE_STATE.UNBALANCED_LEFT) {
1352
- if (getBalanceFactor(leftNode) === BALANCE_STATE.BALANCED || getBalanceFactor(leftNode) === BALANCE_STATE.SLIGHTLY_UNBALANCED_LEFT) {
1353
- return rotateRight(node);
1455
+ if (!node.left && !node.right) {
1456
+ if (!parentNode) {
1457
+ root = null;
1458
+ } else {
1459
+ if (parentNode.left === node) {
1460
+ parentNode.left = null;
1461
+ } else {
1462
+ parentNode.right = null;
1463
+ }
1354
1464
  }
1355
- if (getBalanceFactor(leftNode) === BALANCE_STATE.SLIGHTLY_UNBALANCED_RIGHT) {
1356
- node.left = rotateLeft(leftNode);
1357
- return rotateRight(node);
1465
+ } else if (node.left && node.right) {
1466
+ let minValueNode = node.right;
1467
+ let minValueParent = node;
1468
+ while (minValueNode.left) {
1469
+ minValueParent = minValueNode;
1470
+ minValueNode = minValueNode.left;
1358
1471
  }
1359
- }
1360
- if (balanceFactor === BALANCE_STATE.UNBALANCED_RIGHT) {
1361
- if (getBalanceFactor(rightNode) === BALANCE_STATE.BALANCED || getBalanceFactor(rightNode) === BALANCE_STATE.SLIGHTLY_UNBALANCED_RIGHT) {
1362
- return rotateLeft(node);
1472
+ node.key = minValueNode.key;
1473
+ if (minValueParent === node) {
1474
+ minValueParent.right = minValueNode.right;
1475
+ } else {
1476
+ minValueParent.left = minValueNode.right;
1363
1477
  }
1364
- if (getBalanceFactor(rightNode) === BALANCE_STATE.SLIGHTLY_UNBALANCED_LEFT) {
1365
- node.right = rotateRight(rightNode);
1366
- return rotateLeft(node);
1478
+ } else {
1479
+ const childNode = node.left ? node.left : node.right;
1480
+ if (!parentNode) {
1481
+ root = childNode;
1482
+ } else {
1483
+ if (parentNode.left === node) {
1484
+ parentNode.left = childNode;
1485
+ } else {
1486
+ parentNode.right = childNode;
1487
+ }
1367
1488
  }
1368
1489
  }
1369
- return node;
1490
+ return root;
1370
1491
  }
1371
1492
  function removeDocument(root, id, key) {
1372
1493
  const node = getNodeByKey(root, key);
@@ -1377,7 +1498,7 @@ function removeDocument(root, id, key) {
1377
1498
  node.value.splice(node.value.indexOf(id), 1);
1378
1499
  }
1379
1500
 
1380
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/levenshtein.js
1501
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/levenshtein.js
1381
1502
  function _boundedLevenshtein(a, b, tolerance) {
1382
1503
  if (a === b) {
1383
1504
  return 0;
@@ -1466,19 +1587,27 @@ function syncBoundedLevenshtein(a, b, tolerance) {
1466
1587
  };
1467
1588
  }
1468
1589
 
1469
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/trees/radix.js
1470
- function serialize() {
1471
- const { word, subWord, children, docs, end } = this;
1472
- return {
1473
- word,
1474
- subWord,
1475
- children,
1476
- docs,
1477
- end
1478
- };
1479
- }
1590
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/trees/radix.js
1591
+ var Node = class {
1592
+ constructor(key, subWord, end) {
1593
+ this.key = key;
1594
+ this.subWord = subWord;
1595
+ this.end = end;
1596
+ }
1597
+ children = {};
1598
+ docs = [];
1599
+ word = "";
1600
+ toJSON() {
1601
+ return {
1602
+ word: this.word,
1603
+ subWord: this.subWord,
1604
+ children: this.children,
1605
+ docs: this.docs,
1606
+ end: this.end
1607
+ };
1608
+ }
1609
+ };
1480
1610
  function updateParent(node, parent) {
1481
- node.parent = parent.id;
1482
1611
  node.word = parent.word + node.subWord;
1483
1612
  }
1484
1613
  function addDocument(node, docID) {
@@ -1534,20 +1663,7 @@ function getCommonPrefix(a, b) {
1534
1663
  return commonPrefix;
1535
1664
  }
1536
1665
  function create3(end = false, subWord = "", key = "") {
1537
- const node = {
1538
- id: syncUniqueId(),
1539
- key,
1540
- subWord,
1541
- parent: null,
1542
- children: {},
1543
- docs: [],
1544
- end,
1545
- word: ""
1546
- };
1547
- Object.defineProperty(node, "toJSON", {
1548
- value: serialize
1549
- });
1550
- return node;
1666
+ return new Node(key, subWord, end);
1551
1667
  }
1552
1668
  function insert2(root, word, docId) {
1553
1669
  for (let i = 0; i < word.length; i++) {
@@ -1559,12 +1675,12 @@ function insert2(root, word, docId) {
1559
1675
  const edgeLabelLength = edgeLabel.length;
1560
1676
  const commonPrefix = getCommonPrefix(edgeLabel, wordAtIndex);
1561
1677
  const commonPrefixLength = commonPrefix.length;
1562
- const edgeLabelAtCommonPrefix = edgeLabel[commonPrefixLength];
1563
1678
  if (edgeLabel === wordAtIndex) {
1564
1679
  addDocument(rootChildCurrentChar, docId);
1565
1680
  rootChildCurrentChar.end = true;
1566
1681
  return;
1567
1682
  }
1683
+ const edgeLabelAtCommonPrefix = edgeLabel[commonPrefixLength];
1568
1684
  if (commonPrefixLength < edgeLabelLength && commonPrefixLength === wordAtIndex.length) {
1569
1685
  const newNode = create3(true, wordAtIndex, currentCharacter);
1570
1686
  newNode.children[edgeLabelAtCommonPrefix] = rootChildCurrentChar;
@@ -1649,12 +1765,13 @@ function removeDocumentByWord(root, term, docID, exact = true) {
1649
1765
  return true;
1650
1766
  }
1651
1767
 
1652
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/algorithms.js
1653
- function prioritizeTokenScores(arrays, boost, threshold = 1) {
1768
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/algorithms.js
1769
+ function prioritizeTokenScores(arrays, boost, threshold = 1, keywordsCount) {
1654
1770
  if (boost === 0) {
1655
1771
  throw createError("INVALID_BOOST_VALUE");
1656
1772
  }
1657
- const tokenMap = {};
1773
+ const tokenScoresMap = /* @__PURE__ */ new Map();
1774
+ const tokenKeywordsCountMap = /* @__PURE__ */ new Map();
1658
1775
  const mapsLength = arrays.length;
1659
1776
  for (let i = 0; i < mapsLength; i++) {
1660
1777
  const arr = arrays[i];
@@ -1662,22 +1779,48 @@ function prioritizeTokenScores(arrays, boost, threshold = 1) {
1662
1779
  for (let j = 0; j < entriesLength; j++) {
1663
1780
  const [token, score] = arr[j];
1664
1781
  const boostScore = score * boost;
1665
- if (token in tokenMap) {
1666
- tokenMap[token] *= 1.5 + boostScore;
1782
+ const oldScore = tokenScoresMap.get(token);
1783
+ if (oldScore !== void 0) {
1784
+ tokenScoresMap.set(token, oldScore * 1.5 + boostScore);
1785
+ tokenKeywordsCountMap.set(token, tokenKeywordsCountMap.get(token) + 1);
1667
1786
  } else {
1668
- tokenMap[token] = boostScore;
1787
+ tokenScoresMap.set(token, boostScore);
1788
+ tokenKeywordsCountMap.set(token, 1);
1669
1789
  }
1670
1790
  }
1671
1791
  }
1672
- const results = Object.entries(tokenMap).sort((a, b) => b[1] - a[1]);
1792
+ const tokenScores = [];
1793
+ for (const tokenScoreEntry of tokenScoresMap.entries()) {
1794
+ tokenScores.push(tokenScoreEntry);
1795
+ }
1796
+ const results = tokenScores.sort((a, b) => b[1] - a[1]);
1673
1797
  if (threshold === 1) {
1674
1798
  return results;
1675
1799
  }
1800
+ const allResults = results.length;
1801
+ const tokenKeywordsCount = [];
1802
+ for (const tokenKeywordsCountEntry of tokenKeywordsCountMap.entries()) {
1803
+ tokenKeywordsCount.push(tokenKeywordsCountEntry);
1804
+ }
1805
+ const keywordsPerToken = tokenKeywordsCount.sort((a, b) => b[1] - a[1]);
1806
+ let lastTokenWithAllKeywords = void 0;
1807
+ for (let i = 0; i < allResults; i++) {
1808
+ if (keywordsPerToken[i][1] === keywordsCount) {
1809
+ lastTokenWithAllKeywords = i;
1810
+ } else {
1811
+ break;
1812
+ }
1813
+ }
1814
+ if (typeof lastTokenWithAllKeywords === "undefined") {
1815
+ if (threshold === 0) {
1816
+ return [];
1817
+ }
1818
+ lastTokenWithAllKeywords = 0;
1819
+ }
1676
1820
  if (threshold === 0) {
1677
- const shortestArrayLength = Math.min(...arrays.map((arr) => arr.length));
1678
- return results.slice(0, shortestArrayLength);
1821
+ return results.slice(0, lastTokenWithAllKeywords + 1);
1679
1822
  }
1680
- const thresholdLength = Math.ceil(threshold * 100 * results.length / 100);
1823
+ const thresholdLength = lastTokenWithAllKeywords + Math.ceil(threshold * 100 * (results.length - lastTokenWithAllKeywords) / 100);
1681
1824
  return results.slice(0, results.length + thresholdLength);
1682
1825
  }
1683
1826
  function BM25(tf, matchingCount, docsCount, fieldLength, averageFieldLength, BM25Params) {
@@ -1686,12 +1829,13 @@ function BM25(tf, matchingCount, docsCount, fieldLength, averageFieldLength, BM2
1686
1829
  return idf * (d + tf * (k + 1)) / (tf + k * (1 - b + b * fieldLength / averageFieldLength));
1687
1830
  }
1688
1831
 
1689
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/index.js
1832
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/index.js
1690
1833
  async function insertDocumentScoreParameters(index, prop, id, tokens, docsCount) {
1691
1834
  var _a2;
1835
+ const internalId = getInternalDocumentId(index.sharedInternalDocumentStore, id);
1692
1836
  index.avgFieldLength[prop] = (((_a2 = index.avgFieldLength[prop]) != null ? _a2 : 0) * (docsCount - 1) + tokens.length) / docsCount;
1693
- index.fieldLengths[prop][id] = tokens.length;
1694
- index.frequencies[prop][id] = {};
1837
+ index.fieldLengths[prop][internalId] = tokens.length;
1838
+ index.frequencies[prop][internalId] = {};
1695
1839
  }
1696
1840
  async function insertTokenScoreParameters(index, prop, id, tokens, token) {
1697
1841
  var _a2;
@@ -1701,51 +1845,54 @@ async function insertTokenScoreParameters(index, prop, id, tokens, token) {
1701
1845
  tokenFrequency++;
1702
1846
  }
1703
1847
  }
1848
+ const internalId = getInternalDocumentId(index.sharedInternalDocumentStore, id);
1704
1849
  const tf = tokenFrequency / tokens.length;
1705
- index.frequencies[prop][id][token] = tf;
1706
- if (!(token in index.tokenOccurrencies[prop])) {
1707
- index.tokenOccurrencies[prop][token] = 0;
1850
+ index.frequencies[prop][internalId][token] = tf;
1851
+ if (!(token in index.tokenOccurrences[prop])) {
1852
+ index.tokenOccurrences[prop][token] = 0;
1708
1853
  }
1709
- index.tokenOccurrencies[prop][token] = ((_a2 = index.tokenOccurrencies[prop][token]) != null ? _a2 : 0) + 1;
1854
+ index.tokenOccurrences[prop][token] = ((_a2 = index.tokenOccurrences[prop][token]) != null ? _a2 : 0) + 1;
1710
1855
  }
1711
1856
  async function removeDocumentScoreParameters(index, prop, id, docsCount) {
1712
- index.avgFieldLength[prop] = (index.avgFieldLength[prop] * docsCount - index.fieldLengths[prop][id]) / (docsCount - 1);
1713
- index.fieldLengths[prop][id] = void 0;
1714
- index.frequencies[prop][id] = void 0;
1857
+ const internalId = getInternalDocumentId(index.sharedInternalDocumentStore, id);
1858
+ index.avgFieldLength[prop] = (index.avgFieldLength[prop] * docsCount - index.fieldLengths[prop][internalId]) / (docsCount - 1);
1859
+ index.fieldLengths[prop][internalId] = void 0;
1860
+ index.frequencies[prop][internalId] = void 0;
1715
1861
  }
1716
1862
  async function removeTokenScoreParameters(index, prop, token) {
1717
- index.tokenOccurrencies[prop][token]--;
1863
+ index.tokenOccurrences[prop][token]--;
1718
1864
  }
1719
1865
  async function calculateResultScores(context, index, prop, term, ids) {
1720
1866
  var _a2, _b;
1721
1867
  const documentIDs = Array.from(ids);
1722
1868
  const avgFieldLength = index.avgFieldLength[prop];
1723
1869
  const fieldLengths = index.fieldLengths[prop];
1724
- const oramaOccurrencies = index.tokenOccurrencies[prop];
1870
+ const oramaOccurrences = index.tokenOccurrences[prop];
1725
1871
  const oramaFrequencies = index.frequencies[prop];
1726
- const termOccurrencies = typeof oramaOccurrencies[term] === "number" ? (_a2 = oramaOccurrencies[term]) != null ? _a2 : 0 : 0;
1872
+ const termOccurrences = typeof oramaOccurrences[term] === "number" ? (_a2 = oramaOccurrences[term]) != null ? _a2 : 0 : 0;
1727
1873
  const scoreList = [];
1728
1874
  const documentIDsLength = documentIDs.length;
1729
1875
  for (let k = 0; k < documentIDsLength; k++) {
1730
- var _oramaFrequencies_id;
1731
- const id = documentIDs[k];
1732
- const tf = (_b = oramaFrequencies === null || oramaFrequencies === void 0 ? void 0 : (_oramaFrequencies_id = oramaFrequencies[id]) === null || _oramaFrequencies_id === void 0 ? void 0 : _oramaFrequencies_id[term]) != null ? _b : 0;
1733
- const bm25 = BM25(tf, termOccurrencies, context.docsCount, fieldLengths[id], avgFieldLength, context.params.relevance);
1876
+ var _oramaFrequencies_internalId;
1877
+ const internalId = getInternalDocumentId(index.sharedInternalDocumentStore, documentIDs[k]);
1878
+ const tf = (_b = oramaFrequencies === null || oramaFrequencies === void 0 ? void 0 : (_oramaFrequencies_internalId = oramaFrequencies[internalId]) === null || _oramaFrequencies_internalId === void 0 ? void 0 : _oramaFrequencies_internalId[term]) != null ? _b : 0;
1879
+ const bm25 = BM25(tf, termOccurrences, context.docsCount, fieldLengths[internalId], avgFieldLength, context.params.relevance);
1734
1880
  scoreList.push([
1735
- id,
1881
+ internalId,
1736
1882
  bm25
1737
1883
  ]);
1738
1884
  }
1739
1885
  return scoreList;
1740
1886
  }
1741
- async function create4(orama, schema, index, prefix = "") {
1887
+ async function create4(orama, sharedInternalDocumentStore, schema, index, prefix = "") {
1742
1888
  if (!index) {
1743
1889
  index = {
1890
+ sharedInternalDocumentStore,
1744
1891
  indexes: {},
1745
1892
  searchableProperties: [],
1746
1893
  searchablePropertiesWithTypes: {},
1747
1894
  frequencies: {},
1748
- tokenOccurrencies: {},
1895
+ tokenOccurrences: {},
1749
1896
  avgFieldLength: {},
1750
1897
  fieldLengths: {}
1751
1898
  };
@@ -1754,71 +1901,110 @@ async function create4(orama, schema, index, prefix = "") {
1754
1901
  const typeActualType = typeof type;
1755
1902
  const path = `${prefix}${prefix ? "." : ""}${prop}`;
1756
1903
  if (typeActualType === "object" && !Array.isArray(type)) {
1757
- create4(orama, type, index, path);
1904
+ create4(orama, sharedInternalDocumentStore, type, index, path);
1758
1905
  continue;
1759
1906
  }
1760
1907
  switch (type) {
1761
1908
  case "boolean":
1909
+ case "boolean[]":
1762
1910
  index.indexes[path] = {
1763
1911
  true: [],
1764
1912
  false: []
1765
1913
  };
1766
1914
  break;
1767
1915
  case "number":
1916
+ case "number[]":
1768
1917
  index.indexes[path] = create2(0, []);
1769
1918
  break;
1770
1919
  case "string":
1920
+ case "string[]":
1771
1921
  index.indexes[path] = create3();
1772
1922
  index.avgFieldLength[path] = 0;
1773
1923
  index.frequencies[path] = {};
1774
- index.tokenOccurrencies[path] = {};
1924
+ index.tokenOccurrences[path] = {};
1775
1925
  index.fieldLengths[path] = {};
1776
1926
  break;
1777
1927
  default:
1778
- throw createError("INVALID_SCHEMA_TYPE", Array.isArray(type) ? "array" : typeActualType);
1928
+ throw createError("INVALID_SCHEMA_TYPE", Array.isArray(type) ? "array" : type, path);
1779
1929
  }
1780
1930
  index.searchableProperties.push(path);
1781
1931
  index.searchablePropertiesWithTypes[path] = type;
1782
1932
  }
1783
1933
  return index;
1784
1934
  }
1785
- async function insert3(implementation, index, prop, id, value, language, tokenizer, docsCount) {
1786
- if (typeof value === "number") {
1787
- insert(index.indexes[prop], value, [
1788
- id
1789
- ]);
1790
- return;
1791
- } else if (typeof value === "boolean") {
1792
- index.indexes[prop][value ? "true" : "false"].push(id);
1793
- return;
1935
+ async function insertScalar(implementation, index, prop, id, value, schemaType, language, tokenizer, docsCount) {
1936
+ const internalId = getInternalDocumentId(index.sharedInternalDocumentStore, id);
1937
+ switch (schemaType) {
1938
+ case "boolean": {
1939
+ const booleanIndex = index.indexes[prop];
1940
+ booleanIndex[value ? "true" : "false"].push(internalId);
1941
+ break;
1942
+ }
1943
+ case "number":
1944
+ insert(index.indexes[prop], value, [
1945
+ internalId
1946
+ ]);
1947
+ break;
1948
+ case "string": {
1949
+ const tokens = await tokenizer.tokenize(value, language, prop);
1950
+ await implementation.insertDocumentScoreParameters(index, prop, internalId, tokens, docsCount);
1951
+ for (const token of tokens) {
1952
+ await implementation.insertTokenScoreParameters(index, prop, internalId, tokens, token);
1953
+ insert2(index.indexes[prop], token, internalId);
1954
+ }
1955
+ break;
1956
+ }
1794
1957
  }
1795
- const tokens = await tokenizer.tokenize(value, language, prop);
1796
- await implementation.insertDocumentScoreParameters(index, prop, id, tokens, docsCount);
1797
- for (const token of tokens) {
1798
- await implementation.insertTokenScoreParameters(index, prop, id, tokens, token);
1799
- insert2(index.indexes[prop], token, id);
1958
+ }
1959
+ async function insert3(implementation, index, prop, id, value, schemaType, language, tokenizer, docsCount) {
1960
+ if (!isArrayType(schemaType)) {
1961
+ return insertScalar(implementation, index, prop, id, value, schemaType, language, tokenizer, docsCount);
1962
+ }
1963
+ const innerSchemaType = getInnerType(schemaType);
1964
+ const elements = value;
1965
+ const elementsLength = elements.length;
1966
+ for (let i = 0; i < elementsLength; i++) {
1967
+ await insertScalar(implementation, index, prop, id, elements[i], innerSchemaType, language, tokenizer, docsCount);
1800
1968
  }
1801
1969
  }
1802
- async function remove3(implementation, index, prop, id, value, language, tokenizer, docsCount) {
1803
- if (typeof value === "number") {
1804
- removeDocument(index.indexes[prop], id, value);
1805
- return true;
1806
- } else if (typeof value === "boolean") {
1807
- const booleanKey = value ? "true" : "false";
1808
- const position = index.indexes[prop][booleanKey].indexOf(id);
1809
- index.indexes[prop][value ? "true" : "false"].splice(position, 1);
1810
- return true;
1970
+ async function removeScalar(implementation, index, prop, id, value, schemaType, language, tokenizer, docsCount) {
1971
+ const internalId = getInternalDocumentId(index.sharedInternalDocumentStore, id);
1972
+ switch (schemaType) {
1973
+ case "number": {
1974
+ removeDocument(index.indexes[prop], internalId, value);
1975
+ return true;
1976
+ }
1977
+ case "boolean": {
1978
+ const booleanKey = value ? "true" : "false";
1979
+ const position = index.indexes[prop][booleanKey].indexOf(internalId);
1980
+ index.indexes[prop][value ? "true" : "false"].splice(position, 1);
1981
+ return true;
1982
+ }
1983
+ case "string": {
1984
+ const tokens = await tokenizer.tokenize(value, language, prop);
1985
+ await implementation.removeDocumentScoreParameters(index, prop, id, docsCount);
1986
+ for (const token of tokens) {
1987
+ await implementation.removeTokenScoreParameters(index, prop, token);
1988
+ removeDocumentByWord(index.indexes[prop], token, internalId);
1989
+ }
1990
+ return true;
1991
+ }
1992
+ }
1993
+ }
1994
+ async function remove3(implementation, index, prop, id, value, schemaType, language, tokenizer, docsCount) {
1995
+ if (!isArrayType(schemaType)) {
1996
+ return removeScalar(implementation, index, prop, id, value, schemaType, language, tokenizer, docsCount);
1811
1997
  }
1812
- const tokens = await tokenizer.tokenize(value, language, prop);
1813
- await implementation.removeDocumentScoreParameters(index, prop, id, docsCount);
1814
- for (const token of tokens) {
1815
- await implementation.removeTokenScoreParameters(index, prop, token);
1816
- removeDocumentByWord(index.indexes[prop], token, id);
1998
+ const innerSchemaType = getInnerType(schemaType);
1999
+ const elements = value;
2000
+ const elementsLength = elements.length;
2001
+ for (let i = 0; i < elementsLength; i++) {
2002
+ await removeScalar(implementation, index, prop, id, elements[i], innerSchemaType, language, tokenizer, docsCount);
1817
2003
  }
1818
2004
  return true;
1819
2005
  }
1820
2006
  async function search(context, index, prop, term) {
1821
- if (!(prop in index.tokenOccurrencies)) {
2007
+ if (!(prop in index.tokenOccurrences)) {
1822
2008
  return [];
1823
2009
  }
1824
2010
  const rootNode = index.indexes[prop];
@@ -1846,12 +2032,18 @@ async function searchByWhereClause(context, index, filters) {
1846
2032
  const operation = filters[param];
1847
2033
  if (typeof operation === "boolean") {
1848
2034
  const idx = index.indexes[param];
2035
+ if (typeof idx === "undefined") {
2036
+ throw createError("UNKNOWN_FILTER_PROPERTY", param);
2037
+ }
1849
2038
  const filteredIDs = idx[operation.toString()];
1850
2039
  filtersMap[param].push(...filteredIDs);
1851
2040
  continue;
1852
2041
  }
1853
2042
  if (typeof operation === "string" || Array.isArray(operation)) {
1854
2043
  const idx = index.indexes[param];
2044
+ if (typeof idx === "undefined") {
2045
+ throw createError("UNKNOWN_FILTER_PROPERTY", param);
2046
+ }
1855
2047
  for (const raw of [
1856
2048
  operation
1857
2049
  ].flat()) {
@@ -1871,6 +2063,9 @@ async function searchByWhereClause(context, index, filters) {
1871
2063
  const operationOpt = operationKeys[0];
1872
2064
  const operationValue = operation[operationOpt];
1873
2065
  const AVLNode = index.indexes[param];
2066
+ if (typeof AVLNode === "undefined") {
2067
+ throw createError("UNKNOWN_FILTER_PROPERTY", param);
2068
+ }
1874
2069
  switch (operationOpt) {
1875
2070
  case "gt": {
1876
2071
  const filteredIDs = greaterThan(AVLNode, operationValue, false);
@@ -1913,26 +2108,45 @@ async function getSearchableProperties(index) {
1913
2108
  async function getSearchablePropertiesWithTypes(index) {
1914
2109
  return index.searchablePropertiesWithTypes;
1915
2110
  }
1916
- async function load2(raw) {
1917
- const { indexes, searchableProperties, searchablePropertiesWithTypes, frequencies, tokenOccurrencies, avgFieldLength, fieldLengths } = raw;
2111
+ function loadNode(node) {
2112
+ const convertedNode = create3(node.end, node.subWord, node.key);
2113
+ convertedNode.docs = node.docs;
2114
+ convertedNode.word = node.word;
2115
+ for (const childrenKey of Object.keys(node.children)) {
2116
+ convertedNode.children[childrenKey] = loadNode(node.children[childrenKey]);
2117
+ }
2118
+ return convertedNode;
2119
+ }
2120
+ async function load3(sharedInternalDocumentStore, raw) {
2121
+ const { indexes: rawIndexes, searchableProperties, searchablePropertiesWithTypes, frequencies, tokenOccurrences, avgFieldLength, fieldLengths } = raw;
2122
+ const indexes = {};
2123
+ for (const prop of Object.keys(rawIndexes)) {
2124
+ const value = rawIndexes[prop];
2125
+ if (!("word" in value)) {
2126
+ indexes[prop] = value;
2127
+ continue;
2128
+ }
2129
+ indexes[prop] = loadNode(value);
2130
+ }
1918
2131
  return {
2132
+ sharedInternalDocumentStore,
1919
2133
  indexes,
1920
2134
  searchableProperties,
1921
2135
  searchablePropertiesWithTypes,
1922
2136
  frequencies,
1923
- tokenOccurrencies,
2137
+ tokenOccurrences,
1924
2138
  avgFieldLength,
1925
2139
  fieldLengths
1926
2140
  };
1927
2141
  }
1928
- async function save2(index) {
1929
- const { indexes, searchableProperties, searchablePropertiesWithTypes, frequencies, tokenOccurrencies, avgFieldLength, fieldLengths } = index;
2142
+ async function save3(index) {
2143
+ const { indexes, searchableProperties, searchablePropertiesWithTypes, frequencies, tokenOccurrences, avgFieldLength, fieldLengths } = index;
1930
2144
  return {
1931
2145
  indexes,
1932
2146
  searchableProperties,
1933
2147
  searchablePropertiesWithTypes,
1934
2148
  frequencies,
1935
- tokenOccurrencies,
2149
+ tokenOccurrences,
1936
2150
  avgFieldLength,
1937
2151
  fieldLengths
1938
2152
  };
@@ -1951,12 +2165,12 @@ async function createIndex() {
1951
2165
  searchByWhereClause,
1952
2166
  getSearchableProperties,
1953
2167
  getSearchablePropertiesWithTypes,
1954
- load: load2,
1955
- save: save2
2168
+ load: load3,
2169
+ save: save3
1956
2170
  };
1957
2171
  }
1958
2172
 
1959
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/diacritics.js
2173
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/tokenizer/diacritics.js
1960
2174
  var DIACRITICS_CHARCODE_START = 192;
1961
2175
  var DIACRITICS_CHARCODE_END = 383;
1962
2176
  var CHARCODE_REPLACE_MAPPING = [
@@ -2166,2317 +2380,7 @@ function replaceDiacritics(str) {
2166
2380
  return String.fromCharCode(...stringCharCode);
2167
2381
  }
2168
2382
 
2169
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/en.js
2170
- var en = [
2171
- "i",
2172
- "me",
2173
- "my",
2174
- "myself",
2175
- "we",
2176
- "us",
2177
- "our",
2178
- "ours",
2179
- "ourselves",
2180
- "you",
2181
- "your",
2182
- "yours",
2183
- "yourself",
2184
- "yourselves",
2185
- "he",
2186
- "him",
2187
- "his",
2188
- "himself",
2189
- "she",
2190
- "her",
2191
- "hers",
2192
- "herself",
2193
- "it",
2194
- "its",
2195
- "itself",
2196
- "they",
2197
- "them",
2198
- "their",
2199
- "theirs",
2200
- "themselves",
2201
- "what",
2202
- "which",
2203
- "who",
2204
- "whom",
2205
- "this",
2206
- "that",
2207
- "these",
2208
- "those",
2209
- "am",
2210
- "is",
2211
- "are",
2212
- "was",
2213
- "were",
2214
- "be",
2215
- "been",
2216
- "being",
2217
- "have",
2218
- "has",
2219
- "had",
2220
- "having",
2221
- "do",
2222
- "does",
2223
- "did",
2224
- "doing",
2225
- "will",
2226
- "would",
2227
- "shall",
2228
- "should",
2229
- "can",
2230
- "could",
2231
- "may",
2232
- "might",
2233
- "must",
2234
- "ought",
2235
- "i'm",
2236
- "you're",
2237
- "he's",
2238
- "she's",
2239
- "it's",
2240
- "we're",
2241
- "they're",
2242
- "i've",
2243
- "you've",
2244
- "we've",
2245
- "they've",
2246
- "i'd",
2247
- "you'd",
2248
- "he'd",
2249
- "she'd",
2250
- "we'd",
2251
- "they'd",
2252
- "i'll",
2253
- "you'll",
2254
- "he'll",
2255
- "she'll",
2256
- "we'll",
2257
- "they'll",
2258
- "isn't",
2259
- "aren't",
2260
- "wasn't",
2261
- "weren't",
2262
- "hasn't",
2263
- "haven't",
2264
- "hadn't",
2265
- "doesn't",
2266
- "don't",
2267
- "didn't",
2268
- "won't",
2269
- "wouldn't",
2270
- "shan't",
2271
- "shouldn't",
2272
- "can't",
2273
- "cannot",
2274
- "couldn't",
2275
- "mustn't",
2276
- "let's",
2277
- "that's",
2278
- "who's",
2279
- "what's",
2280
- "here's",
2281
- "there's",
2282
- "when's",
2283
- "where's",
2284
- "why's",
2285
- "how's",
2286
- "an",
2287
- "the",
2288
- "and",
2289
- "but",
2290
- "if",
2291
- "or",
2292
- "because",
2293
- "as",
2294
- "until",
2295
- "while",
2296
- "of",
2297
- "at",
2298
- "by",
2299
- "for",
2300
- "with",
2301
- "about",
2302
- "against",
2303
- "between",
2304
- "into",
2305
- "through",
2306
- "during",
2307
- "before",
2308
- "after",
2309
- "above",
2310
- "below",
2311
- "to",
2312
- "from",
2313
- "up",
2314
- "down",
2315
- "in",
2316
- "out",
2317
- "on",
2318
- "off",
2319
- "over",
2320
- "under",
2321
- "again",
2322
- "further",
2323
- "then",
2324
- "once",
2325
- "here",
2326
- "there",
2327
- "when",
2328
- "where",
2329
- "why",
2330
- "how",
2331
- "all",
2332
- "any",
2333
- "both",
2334
- "each",
2335
- "few",
2336
- "more",
2337
- "most",
2338
- "other",
2339
- "some",
2340
- "such",
2341
- "no",
2342
- "nor",
2343
- "not",
2344
- "only",
2345
- "own",
2346
- "same",
2347
- "so",
2348
- "than",
2349
- "too",
2350
- "very"
2351
- ];
2352
-
2353
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/it.js
2354
- var it = [
2355
- "ad",
2356
- "al",
2357
- "allo",
2358
- "ai",
2359
- "agli",
2360
- "all",
2361
- "agl",
2362
- "alla",
2363
- "alle",
2364
- "con",
2365
- "col",
2366
- "coi",
2367
- "da",
2368
- "dal",
2369
- "dallo",
2370
- "dai",
2371
- "dagli",
2372
- "dall",
2373
- "dagl",
2374
- "dalla",
2375
- "dalle",
2376
- "di",
2377
- "del",
2378
- "dello",
2379
- "dei",
2380
- "degli",
2381
- "dell",
2382
- "degl",
2383
- "della",
2384
- "delle",
2385
- "in",
2386
- "nel",
2387
- "nello",
2388
- "nei",
2389
- "negli",
2390
- "nell",
2391
- "negl",
2392
- "nella",
2393
- "nelle",
2394
- "su",
2395
- "sul",
2396
- "sullo",
2397
- "sui",
2398
- "sugli",
2399
- "sull",
2400
- "sugl",
2401
- "sulla",
2402
- "sulle",
2403
- "per",
2404
- "tra",
2405
- "contro",
2406
- "io",
2407
- "tu",
2408
- "lui",
2409
- "lei",
2410
- "noi",
2411
- "voi",
2412
- "loro",
2413
- "mio",
2414
- "mia",
2415
- "miei",
2416
- "mie",
2417
- "tuo",
2418
- "tua",
2419
- "tuoi",
2420
- "tue",
2421
- "suo",
2422
- "sua",
2423
- "suoi",
2424
- "sue",
2425
- "nostro",
2426
- "nostra",
2427
- "nostri",
2428
- "nostre",
2429
- "vostro",
2430
- "vostra",
2431
- "vostri",
2432
- "vostre",
2433
- "mi",
2434
- "ti",
2435
- "ci",
2436
- "vi",
2437
- "lo",
2438
- "la",
2439
- "li",
2440
- "le",
2441
- "gli",
2442
- "ne",
2443
- "il",
2444
- "un",
2445
- "uno",
2446
- "una",
2447
- "ma",
2448
- "ed",
2449
- "se",
2450
- "perch\xE9",
2451
- "anche",
2452
- "come",
2453
- "dov",
2454
- "dove",
2455
- "che",
2456
- "chi",
2457
- "cui",
2458
- "non",
2459
- "pi\xF9",
2460
- "quale",
2461
- "quanto",
2462
- "quanti",
2463
- "quanta",
2464
- "quante",
2465
- "quello",
2466
- "quelli",
2467
- "quella",
2468
- "quelle",
2469
- "questo",
2470
- "questi",
2471
- "questa",
2472
- "queste",
2473
- "si",
2474
- "tutto",
2475
- "tutti",
2476
- "a",
2477
- "c",
2478
- "e",
2479
- "i",
2480
- "l",
2481
- "o",
2482
- "ho",
2483
- "hai",
2484
- "ha",
2485
- "abbiamo",
2486
- "avete",
2487
- "hanno",
2488
- "abbia",
2489
- "abbiate",
2490
- "abbiano",
2491
- "avr\xF2",
2492
- "avrai",
2493
- "avr\xE0",
2494
- "avremo",
2495
- "avrete",
2496
- "avranno",
2497
- "avrei",
2498
- "avresti",
2499
- "avrebbe",
2500
- "avremmo",
2501
- "avreste",
2502
- "avrebbero",
2503
- "avevo",
2504
- "avevi",
2505
- "aveva",
2506
- "avevamo",
2507
- "avevate",
2508
- "avevano",
2509
- "ebbi",
2510
- "avesti",
2511
- "ebbe",
2512
- "avemmo",
2513
- "aveste",
2514
- "ebbero",
2515
- "avessi",
2516
- "avesse",
2517
- "avessimo",
2518
- "avessero",
2519
- "avendo",
2520
- "avuto",
2521
- "avuta",
2522
- "avuti",
2523
- "avute",
2524
- "sono",
2525
- "sei",
2526
- "\xE8",
2527
- "siamo",
2528
- "siete",
2529
- "sia",
2530
- "siate",
2531
- "siano",
2532
- "sar\xF2",
2533
- "sarai",
2534
- "sar\xE0",
2535
- "saremo",
2536
- "sarete",
2537
- "saranno",
2538
- "sarei",
2539
- "saresti",
2540
- "sarebbe",
2541
- "saremmo",
2542
- "sareste",
2543
- "sarebbero",
2544
- "ero",
2545
- "eri",
2546
- "era",
2547
- "eravamo",
2548
- "eravate",
2549
- "erano",
2550
- "fui",
2551
- "fosti",
2552
- "fu",
2553
- "fummo",
2554
- "foste",
2555
- "furono",
2556
- "fossi",
2557
- "fosse",
2558
- "fossimo",
2559
- "fossero",
2560
- "essendo",
2561
- "faccio",
2562
- "fai",
2563
- "facciamo",
2564
- "fanno",
2565
- "faccia",
2566
- "facciate",
2567
- "facciano",
2568
- "far\xF2",
2569
- "farai",
2570
- "far\xE0",
2571
- "faremo",
2572
- "farete",
2573
- "faranno",
2574
- "farei",
2575
- "faresti",
2576
- "farebbe",
2577
- "faremmo",
2578
- "fareste",
2579
- "farebbero",
2580
- "facevo",
2581
- "facevi",
2582
- "faceva",
2583
- "facevamo",
2584
- "facevate",
2585
- "facevano",
2586
- "feci",
2587
- "facesti",
2588
- "fece",
2589
- "facemmo",
2590
- "faceste",
2591
- "fecero",
2592
- "facessi",
2593
- "facesse",
2594
- "facessimo",
2595
- "facessero",
2596
- "facendo",
2597
- "sto",
2598
- "stai",
2599
- "sta",
2600
- "stiamo",
2601
- "stanno",
2602
- "stia",
2603
- "stiate",
2604
- "stiano",
2605
- "star\xF2",
2606
- "starai",
2607
- "star\xE0",
2608
- "staremo",
2609
- "starete",
2610
- "staranno",
2611
- "starei",
2612
- "staresti",
2613
- "starebbe",
2614
- "staremmo",
2615
- "stareste",
2616
- "starebbero",
2617
- "stavo",
2618
- "stavi",
2619
- "stava",
2620
- "stavamo",
2621
- "stavate",
2622
- "stavano",
2623
- "stetti",
2624
- "stesti",
2625
- "stette",
2626
- "stemmo",
2627
- "steste",
2628
- "stettero",
2629
- "stessi",
2630
- "stesse",
2631
- "stessimo",
2632
- "stessero",
2633
- "stando"
2634
- ];
2635
-
2636
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/fr.js
2637
- var fr = [
2638
- "au",
2639
- "aux",
2640
- "avec",
2641
- "ce",
2642
- "ces",
2643
- "dans",
2644
- "de",
2645
- "des",
2646
- "du",
2647
- "elle",
2648
- "en",
2649
- "et",
2650
- "eux",
2651
- "il",
2652
- "je",
2653
- "la",
2654
- "le",
2655
- "leur",
2656
- "lui",
2657
- "ma",
2658
- "mais",
2659
- "me",
2660
- "m\xEAme",
2661
- "mes",
2662
- "moi",
2663
- "mon",
2664
- "ne",
2665
- "nos",
2666
- "notre",
2667
- "nous",
2668
- "on",
2669
- "ou",
2670
- "par",
2671
- "pas",
2672
- "pour",
2673
- "qu",
2674
- "que",
2675
- "qui",
2676
- "sa",
2677
- "se",
2678
- "ses",
2679
- "son",
2680
- "sur",
2681
- "ta",
2682
- "te",
2683
- "tes",
2684
- "toi",
2685
- "ton",
2686
- "tu",
2687
- "un",
2688
- "une",
2689
- "vos",
2690
- "votre",
2691
- "vous",
2692
- "c",
2693
- "d",
2694
- "j",
2695
- "l",
2696
- "\xE0",
2697
- "m",
2698
- "n",
2699
- "s",
2700
- "t",
2701
- "y",
2702
- "",
2703
- "\xE9t\xE9",
2704
- "\xE9t\xE9e",
2705
- "\xE9t\xE9es",
2706
- "\xE9t\xE9s",
2707
- "\xE9tant",
2708
- "suis",
2709
- "es",
2710
- "est",
2711
- "sommes",
2712
- "\xEAtes",
2713
- "sont",
2714
- "serai",
2715
- "seras",
2716
- "sera",
2717
- "serons",
2718
- "serez",
2719
- "seront",
2720
- "serais",
2721
- "serait",
2722
- "serions",
2723
- "seriez",
2724
- "seraient",
2725
- "\xE9tais",
2726
- "\xE9tait",
2727
- "\xE9tions",
2728
- "\xE9tiez",
2729
- "\xE9taient",
2730
- "fus",
2731
- "fut",
2732
- "f\xFBmes",
2733
- "f\xFBtes",
2734
- "furent",
2735
- "sois",
2736
- "soit",
2737
- "soyons",
2738
- "soyez",
2739
- "soient",
2740
- "fusse",
2741
- "fusses",
2742
- "f\xFBt",
2743
- "fussions",
2744
- "fussiez",
2745
- "fussent",
2746
- "ayant",
2747
- "eu",
2748
- "eue",
2749
- "eues",
2750
- "eus",
2751
- "ai",
2752
- "as",
2753
- "avons",
2754
- "avez",
2755
- "ont",
2756
- "aurai",
2757
- "auras",
2758
- "aura",
2759
- "aurons",
2760
- "aurez",
2761
- "auront",
2762
- "aurais",
2763
- "aurait",
2764
- "aurions",
2765
- "auriez",
2766
- "auraient",
2767
- "avais",
2768
- "avait",
2769
- "avions",
2770
- "aviez",
2771
- "avaient",
2772
- "eut",
2773
- "e\xFBmes",
2774
- "e\xFBtes",
2775
- "eurent",
2776
- "aie",
2777
- "aies",
2778
- "ait",
2779
- "ayons",
2780
- "ayez",
2781
- "aient",
2782
- "eusse",
2783
- "eusses",
2784
- "e\xFBt",
2785
- "eussions",
2786
- "eussiez",
2787
- "eussent",
2788
- "ceci",
2789
- "cela",
2790
- "cel\xE0",
2791
- "cet",
2792
- "cette",
2793
- "ici",
2794
- "ils",
2795
- "les",
2796
- "leurs",
2797
- "quel",
2798
- "quels",
2799
- "quelle",
2800
- "quelles",
2801
- "sans",
2802
- "soi"
2803
- ];
2804
-
2805
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/es.js
2806
- var es = [
2807
- "de",
2808
- "la",
2809
- "que",
2810
- "el",
2811
- "en",
2812
- "y",
2813
- "a",
2814
- "los",
2815
- "del",
2816
- "se",
2817
- "las",
2818
- "por",
2819
- "un",
2820
- "para",
2821
- "con",
2822
- "no",
2823
- "una",
2824
- "su",
2825
- "al",
2826
- "lo",
2827
- "como",
2828
- "m\xE1s",
2829
- "pero",
2830
- "sus",
2831
- "le",
2832
- "ya",
2833
- "o",
2834
- "este",
2835
- "s\xED",
2836
- "porque",
2837
- "esta",
2838
- "entre",
2839
- "cuando",
2840
- "muy",
2841
- "sin",
2842
- "sobre",
2843
- "tambi\xE9n",
2844
- "me",
2845
- "hasta",
2846
- "hay",
2847
- "donde",
2848
- "quien",
2849
- "desde",
2850
- "todo",
2851
- "nos",
2852
- "durante",
2853
- "todos",
2854
- "uno",
2855
- "les",
2856
- "ni",
2857
- "contra",
2858
- "otros",
2859
- "ese",
2860
- "eso",
2861
- "ante",
2862
- "ellos",
2863
- "e",
2864
- "esto",
2865
- "m\xED",
2866
- "antes",
2867
- "algunos",
2868
- "qu\xE9",
2869
- "unos",
2870
- "yo",
2871
- "otro",
2872
- "otras",
2873
- "otra",
2874
- "\xE9l",
2875
- "tanto",
2876
- "esa",
2877
- "estos",
2878
- "mucho",
2879
- "quienes",
2880
- "nada",
2881
- "muchos",
2882
- "cual",
2883
- "poco",
2884
- "ella",
2885
- "estar",
2886
- "estas",
2887
- "algunas",
2888
- "algo",
2889
- "nosotros",
2890
- "mi",
2891
- "mis",
2892
- "t\xFA",
2893
- "te",
2894
- "ti",
2895
- "tu",
2896
- "tus",
2897
- "ellas",
2898
- "nosotras",
2899
- "vosotros",
2900
- "vosotras",
2901
- "os",
2902
- "m\xEDo",
2903
- "m\xEDa",
2904
- "m\xEDos",
2905
- "m\xEDas",
2906
- "tuyo",
2907
- "tuya",
2908
- "tuyos",
2909
- "tuyas",
2910
- "suyo",
2911
- "suya",
2912
- "suyos",
2913
- "suyas",
2914
- "nuestro",
2915
- "nuestra",
2916
- "nuestros",
2917
- "nuestras",
2918
- "vuestro",
2919
- "vuestra",
2920
- "vuestros",
2921
- "vuestras",
2922
- "esos",
2923
- "esas",
2924
- "estoy",
2925
- "est\xE1s",
2926
- "est\xE1",
2927
- "estamos",
2928
- "est\xE1is",
2929
- "est\xE1n",
2930
- "est\xE9",
2931
- "est\xE9s",
2932
- "estemos",
2933
- "est\xE9is",
2934
- "est\xE9n",
2935
- "estar\xE9",
2936
- "estar\xE1s",
2937
- "estar\xE1",
2938
- "estaremos",
2939
- "estar\xE9is",
2940
- "estar\xE1n",
2941
- "estar\xEDa",
2942
- "estar\xEDas",
2943
- "estar\xEDamos",
2944
- "estar\xEDais",
2945
- "estar\xEDan",
2946
- "estaba",
2947
- "estabas",
2948
- "est\xE1bamos",
2949
- "estabais",
2950
- "estaban",
2951
- "estuve",
2952
- "estuviste",
2953
- "estuvo",
2954
- "estuvimos",
2955
- "estuvisteis",
2956
- "estuvieron",
2957
- "estuviera",
2958
- "estuvieras",
2959
- "estuvi\xE9ramos",
2960
- "estuvierais",
2961
- "estuvieran",
2962
- "estuviese",
2963
- "estuvieses",
2964
- "estuvi\xE9semos",
2965
- "estuvieseis",
2966
- "estuviesen",
2967
- "estando",
2968
- "estado",
2969
- "estada",
2970
- "estados",
2971
- "estadas",
2972
- "estad",
2973
- "he",
2974
- "has",
2975
- "ha",
2976
- "hemos",
2977
- "hab\xE9is",
2978
- "han",
2979
- "haya",
2980
- "hayas",
2981
- "hayamos",
2982
- "hay\xE1is",
2983
- "hayan",
2984
- "habr\xE9",
2985
- "habr\xE1s",
2986
- "habr\xE1",
2987
- "habremos",
2988
- "habr\xE9is",
2989
- "habr\xE1n",
2990
- "habr\xEDa",
2991
- "habr\xEDas",
2992
- "habr\xEDamos",
2993
- "habr\xEDais",
2994
- "habr\xEDan",
2995
- "hab\xEDa",
2996
- "hab\xEDas",
2997
- "hab\xEDamos",
2998
- "hab\xEDais",
2999
- "hab\xEDan",
3000
- "hube",
3001
- "hubiste",
3002
- "hubo",
3003
- "hubimos",
3004
- "hubisteis",
3005
- "hubieron",
3006
- "hubiera",
3007
- "hubieras",
3008
- "hubi\xE9ramos",
3009
- "hubierais",
3010
- "hubieran",
3011
- "hubiese",
3012
- "hubieses",
3013
- "hubi\xE9semos",
3014
- "hubieseis",
3015
- "hubiesen",
3016
- "habiendo",
3017
- "habido",
3018
- "habida",
3019
- "habidos",
3020
- "habidas",
3021
- "soy",
3022
- "eres",
3023
- "es",
3024
- "somos",
3025
- "sois",
3026
- "son",
3027
- "sea",
3028
- "seas",
3029
- "seamos",
3030
- "se\xE1is",
3031
- "sean",
3032
- "ser\xE9",
3033
- "ser\xE1s",
3034
- "ser\xE1",
3035
- "seremos",
3036
- "ser\xE9is",
3037
- "ser\xE1n",
3038
- "ser\xEDa",
3039
- "ser\xEDas",
3040
- "ser\xEDamos",
3041
- "ser\xEDais",
3042
- "ser\xEDan",
3043
- "era",
3044
- "eras",
3045
- "\xE9ramos",
3046
- "erais",
3047
- "eran",
3048
- "fui",
3049
- "fuiste",
3050
- "fue",
3051
- "fuimos",
3052
- "fuisteis",
3053
- "fueron",
3054
- "fuera",
3055
- "fueras",
3056
- "fu\xE9ramos",
3057
- "fuerais",
3058
- "fueran",
3059
- "fuese",
3060
- "fueses",
3061
- "fu\xE9semos",
3062
- "fueseis",
3063
- "fuesen",
3064
- "siendo",
3065
- "sido",
3066
- "tengo",
3067
- "tienes",
3068
- "tiene",
3069
- "tenemos",
3070
- "ten\xE9is",
3071
- "tienen",
3072
- "tenga",
3073
- "tengas",
3074
- "tengamos",
3075
- "teng\xE1is",
3076
- "tengan",
3077
- "tendr\xE9",
3078
- "tendr\xE1s",
3079
- "tendr\xE1",
3080
- "tendremos",
3081
- "tendr\xE9is",
3082
- "tendr\xE1n",
3083
- "tendr\xEDa",
3084
- "tendr\xEDas",
3085
- "tendr\xEDamos",
3086
- "tendr\xEDais",
3087
- "tendr\xEDan",
3088
- "ten\xEDa",
3089
- "ten\xEDas",
3090
- "ten\xEDamos",
3091
- "ten\xEDais",
3092
- "ten\xEDan",
3093
- "tuve",
3094
- "tuviste",
3095
- "tuvo",
3096
- "tuvimos",
3097
- "tuvisteis",
3098
- "tuvieron",
3099
- "tuviera",
3100
- "tuvieras",
3101
- "tuvi\xE9ramos",
3102
- "tuvierais",
3103
- "tuvieran",
3104
- "tuviese",
3105
- "tuvieses",
3106
- "tuvi\xE9semos",
3107
- "tuvieseis",
3108
- "tuviesen",
3109
- "teniendo",
3110
- "tenido",
3111
- "tenida",
3112
- "tenidos",
3113
- "tenidas",
3114
- "tened"
3115
- ];
3116
-
3117
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/pt.js
3118
- var pt = [
3119
- "de",
3120
- "a",
3121
- "o",
3122
- "que",
3123
- "e",
3124
- "do",
3125
- "da",
3126
- "em",
3127
- "um",
3128
- "para",
3129
- "com",
3130
- "n\xE3o",
3131
- "uma",
3132
- "os",
3133
- "no",
3134
- "se",
3135
- "na",
3136
- "por",
3137
- "mais",
3138
- "as",
3139
- "dos",
3140
- "como",
3141
- "mas",
3142
- "ao",
3143
- "ele",
3144
- "das",
3145
- "\xE0",
3146
- "seu",
3147
- "sua",
3148
- "ou",
3149
- "quando",
3150
- "muito",
3151
- "nos",
3152
- "j\xE1",
3153
- "eu",
3154
- "tamb\xE9m",
3155
- "s\xF3",
3156
- "pelo",
3157
- "pela",
3158
- "at\xE9",
3159
- "isso",
3160
- "ela",
3161
- "entre",
3162
- "depois",
3163
- "sem",
3164
- "mesmo",
3165
- "aos",
3166
- "seus",
3167
- "quem",
3168
- "nas",
3169
- "me",
3170
- "esse",
3171
- "eles",
3172
- "voc\xEA",
3173
- "essa",
3174
- "num",
3175
- "nem",
3176
- "suas",
3177
- "meu",
3178
- "\xE0s",
3179
- "minha",
3180
- "numa",
3181
- "pelos",
3182
- "elas",
3183
- "qual",
3184
- "n\xF3s",
3185
- "lhe",
3186
- "deles",
3187
- "essas",
3188
- "esses",
3189
- "pelas",
3190
- "este",
3191
- "dele",
3192
- "tu",
3193
- "te",
3194
- "voc\xEAs",
3195
- "vos",
3196
- "lhes",
3197
- "meus",
3198
- "minhas",
3199
- "teu",
3200
- "tua",
3201
- "teus",
3202
- "tuas",
3203
- "nosso",
3204
- "nossa",
3205
- "nossos",
3206
- "nossas",
3207
- "dela",
3208
- "delas",
3209
- "esta",
3210
- "estes",
3211
- "estas",
3212
- "aquele",
3213
- "aquela",
3214
- "aqueles",
3215
- "aquelas",
3216
- "isto",
3217
- "aquilo",
3218
- "estou",
3219
- "est\xE1",
3220
- "estamos",
3221
- "est\xE3o",
3222
- "estive",
3223
- "esteve",
3224
- "estivemos",
3225
- "estiveram",
3226
- "estava",
3227
- "est\xE1vamos",
3228
- "estavam",
3229
- "estivera",
3230
- "estiv\xE9ramos",
3231
- "esteja",
3232
- "estejamos",
3233
- "estejam",
3234
- "estivesse",
3235
- "estiv\xE9ssemos",
3236
- "estivessem",
3237
- "estiver",
3238
- "estivermos",
3239
- "estiverem",
3240
- "hei",
3241
- "h\xE1",
3242
- "havemos",
3243
- "h\xE3o",
3244
- "houve",
3245
- "houvemos",
3246
- "houveram",
3247
- "houvera",
3248
- "houv\xE9ramos",
3249
- "haja",
3250
- "hajamos",
3251
- "hajam",
3252
- "houvesse",
3253
- "houv\xE9ssemos",
3254
- "houvessem",
3255
- "houver",
3256
- "houvermos",
3257
- "houverem",
3258
- "houverei",
3259
- "houver\xE1",
3260
- "houveremos",
3261
- "houver\xE3o",
3262
- "houveria",
3263
- "houver\xEDamos",
3264
- "houveriam",
3265
- "sou",
3266
- "somos",
3267
- "s\xE3o",
3268
- "era",
3269
- "\xE9ramos",
3270
- "eram",
3271
- "fui",
3272
- "foi",
3273
- "fomos",
3274
- "foram",
3275
- "fora",
3276
- "f\xF4ramos",
3277
- "seja",
3278
- "sejamos",
3279
- "sejam",
3280
- "fosse",
3281
- "f\xF4ssemos",
3282
- "fossem",
3283
- "for",
3284
- "formos",
3285
- "forem",
3286
- "serei",
3287
- "ser\xE1",
3288
- "seremos",
3289
- "ser\xE3o",
3290
- "seria",
3291
- "ser\xEDamos",
3292
- "seriam",
3293
- "tenho",
3294
- "tem",
3295
- "temos",
3296
- "t\xE9m",
3297
- "tinha",
3298
- "t\xEDnhamos",
3299
- "tinham",
3300
- "tive",
3301
- "teve",
3302
- "tivemos",
3303
- "tiveram",
3304
- "tivera",
3305
- "tiv\xE9ramos",
3306
- "tenha",
3307
- "tenhamos",
3308
- "tenham",
3309
- "tivesse",
3310
- "tiv\xE9ssemos",
3311
- "tivessem",
3312
- "tiver",
3313
- "tivermos",
3314
- "tiverem",
3315
- "terei",
3316
- "ter\xE1",
3317
- "teremos",
3318
- "ter\xE3o",
3319
- "teria",
3320
- "ter\xEDamos",
3321
- "teriam"
3322
- ];
3323
-
3324
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/nl.js
3325
- var nl = [
3326
- "de",
3327
- "en",
3328
- "van",
3329
- "ik",
3330
- "te",
3331
- "dat",
3332
- "die",
3333
- "in",
3334
- "een",
3335
- "hij",
3336
- "het",
3337
- "niet",
3338
- "zijn",
3339
- "is",
3340
- "was",
3341
- "op",
3342
- "aan",
3343
- "met",
3344
- "als",
3345
- "voor",
3346
- "had",
3347
- "er",
3348
- "maar",
3349
- "om",
3350
- "hem",
3351
- "dan",
3352
- "zou",
3353
- "of",
3354
- "wat",
3355
- "mijn",
3356
- "men",
3357
- "dit",
3358
- "zo",
3359
- "door",
3360
- "over",
3361
- "ze",
3362
- "zich",
3363
- "bij",
3364
- "ook",
3365
- "tot",
3366
- "je",
3367
- "mij",
3368
- "uit",
3369
- "der",
3370
- "daar",
3371
- "haar",
3372
- "naar",
3373
- "heb",
3374
- "hoe",
3375
- "heeft",
3376
- "hebben",
3377
- "deze",
3378
- "u",
3379
- "want",
3380
- "nog",
3381
- "zal",
3382
- "me",
3383
- "zij",
3384
- "nu",
3385
- "ge",
3386
- "geen",
3387
- "omdat",
3388
- "iets",
3389
- "worden",
3390
- "toch",
3391
- "al",
3392
- "waren",
3393
- "veel",
3394
- "meer",
3395
- "doen",
3396
- "toen",
3397
- "moet",
3398
- "ben",
3399
- "zonder",
3400
- "kan",
3401
- "hun",
3402
- "dus",
3403
- "alles",
3404
- "onder",
3405
- "ja",
3406
- "eens",
3407
- "hier",
3408
- "wie",
3409
- "werd",
3410
- "altijd",
3411
- "doch",
3412
- "wordt",
3413
- "wezen",
3414
- "kunnen",
3415
- "ons",
3416
- "zelf",
3417
- "tegen",
3418
- "na",
3419
- "reeds",
3420
- "wil",
3421
- "kon",
3422
- "niets",
3423
- "uw",
3424
- "iemand",
3425
- "geweest",
3426
- "andere"
3427
- ];
3428
-
3429
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/se.js
3430
- var se = [
3431
- "och",
3432
- "det",
3433
- "att",
3434
- "i",
3435
- "en",
3436
- "jag",
3437
- "hon",
3438
- "som",
3439
- "han",
3440
- "p\xE5",
3441
- "den",
3442
- "med",
3443
- "var",
3444
- "sig",
3445
- "f\xF6r",
3446
- "s\xE5",
3447
- "till",
3448
- "\xE4r",
3449
- "men",
3450
- "ett",
3451
- "om",
3452
- "hade",
3453
- "de",
3454
- "av",
3455
- "icke",
3456
- "mig",
3457
- "du",
3458
- "henne",
3459
- "d\xE5",
3460
- "sin",
3461
- "nu",
3462
- "har",
3463
- "inte",
3464
- "hans",
3465
- "honom",
3466
- "skulle",
3467
- "hennes",
3468
- "d\xE4r",
3469
- "min",
3470
- "man",
3471
- "ej",
3472
- "vid",
3473
- "kunde",
3474
- "n\xE5got",
3475
- "fr\xE5n",
3476
- "ut",
3477
- "n\xE4r",
3478
- "efter",
3479
- "upp",
3480
- "vi",
3481
- "dem",
3482
- "vara",
3483
- "vad",
3484
- "\xF6ver",
3485
- "\xE4n",
3486
- "dig",
3487
- "kan",
3488
- "sina",
3489
- "h\xE4r",
3490
- "ha",
3491
- "mot",
3492
- "alla",
3493
- "under",
3494
- "n\xE5gon",
3495
- "eller",
3496
- "allt",
3497
- "mycket",
3498
- "sedan",
3499
- "ju",
3500
- "denna",
3501
- "sj\xE4lv",
3502
- "detta",
3503
- "\xE5t",
3504
- "utan",
3505
- "varit",
3506
- "hur",
3507
- "ingen",
3508
- "mitt",
3509
- "ni",
3510
- "bli",
3511
- "blev",
3512
- "oss",
3513
- "din",
3514
- "dessa",
3515
- "n\xE5gra",
3516
- "deras",
3517
- "blir",
3518
- "mina",
3519
- "samma",
3520
- "vilken",
3521
- "er",
3522
- "s\xE5dan",
3523
- "v\xE5r",
3524
- "blivit",
3525
- "dess",
3526
- "inom",
3527
- "mellan",
3528
- "s\xE5dant",
3529
- "varf\xF6r",
3530
- "varje",
3531
- "vilka",
3532
- "ditt",
3533
- "vem",
3534
- "vilket",
3535
- "sitta",
3536
- "s\xE5dana",
3537
- "vart",
3538
- "dina",
3539
- "vars",
3540
- "v\xE5rt",
3541
- "v\xE5ra",
3542
- "ert",
3543
- "era",
3544
- "vilkas"
3545
- ];
3546
-
3547
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/ru.js
3548
- var ru = [
3549
- "\u0438",
3550
- "\u0432",
3551
- "\u0432\u043E",
3552
- "\u043D\u0435",
3553
- "\u0447\u0442\u043E",
3554
- "\u043E\u043D",
3555
- "\u043D\u0430",
3556
- "\u044F",
3557
- "\u0441",
3558
- "\u0441\u043E",
3559
- "\u043A\u0430\u043A",
3560
- "\u0430",
3561
- "\u0442\u043E",
3562
- "\u0432\u0441\u0435",
3563
- "\u043E\u043D\u0430",
3564
- "\u0442\u0430\u043A",
3565
- "\u0435\u0433\u043E",
3566
- "\u043D\u043E",
3567
- "\u0434\u0430",
3568
- "\u0442\u044B",
3569
- "\u043A",
3570
- "\u0443",
3571
- "\u0436\u0435",
3572
- "\u0432\u044B",
3573
- "\u0437\u0430",
3574
- "\u0431\u044B",
3575
- "\u043F\u043E",
3576
- "\u0442\u043E\u043B\u044C\u043A\u043E",
3577
- "\u0435\u0435",
3578
- "\u043C\u043D\u0435",
3579
- "\u0431\u044B\u043B\u043E",
3580
- "\u0432\u043E\u0442",
3581
- "\u043E\u0442",
3582
- "\u043C\u0435\u043D\u044F",
3583
- "\u0435\u0449\u0435",
3584
- "\u043D\u0435\u0442",
3585
- "\u043E",
3586
- "\u0438\u0437",
3587
- "\u0435\u043C\u0443",
3588
- "\u0442\u0435\u043F\u0435\u0440\u044C",
3589
- "\u043A\u043E\u0433\u0434\u0430",
3590
- "\u0434\u0430\u0436\u0435",
3591
- "\u043D\u0443",
3592
- "\u0432\u0434\u0440\u0443\u0433",
3593
- "\u043B\u0438",
3594
- "\u0435\u0441\u043B\u0438",
3595
- "\u0443\u0436\u0435",
3596
- "\u0438\u043B\u0438",
3597
- "\u043D\u0438",
3598
- "\u0431\u044B\u0442\u044C",
3599
- "\u0431\u044B\u043B",
3600
- "\u043D\u0435\u0433\u043E",
3601
- "\u0434\u043E",
3602
- "\u0432\u0430\u0441",
3603
- "\u043D\u0438\u0431\u0443\u0434\u044C",
3604
- "\u043E\u043F\u044F\u0442\u044C",
3605
- "\u0443\u0436",
3606
- "\u0432\u0430\u043C",
3607
- "\u0441\u043A\u0430\u0437\u0430\u043B",
3608
- "\u0432\u0435\u0434\u044C",
3609
- "\u0442\u0430\u043C",
3610
- "\u043F\u043E\u0442\u043E\u043C",
3611
- "\u0441\u0435\u0431\u044F",
3612
- "\u043D\u0438\u0447\u0435\u0433\u043E",
3613
- "\u0435\u0439",
3614
- "\u043C\u043E\u0436\u0435\u0442",
3615
- "\u043E\u043D\u0438",
3616
- "\u0442\u0443\u0442",
3617
- "\u0433\u0434\u0435",
3618
- "\u0435\u0441\u0442\u044C",
3619
- "\u043D\u0430\u0434\u043E",
3620
- "\u043D\u0435\u0439",
3621
- "\u0434\u043B\u044F",
3622
- "\u043C\u044B",
3623
- "\u0442\u0435\u0431\u044F",
3624
- "\u0438\u0445",
3625
- "\u0447\u0435\u043C",
3626
- "\u0431\u044B\u043B\u0430",
3627
- "\u0441\u0430\u043C",
3628
- "\u0447\u0442\u043E\u0431",
3629
- "\u0431\u0435\u0437",
3630
- "\u0431\u0443\u0434\u0442\u043E",
3631
- "\u0447\u0435\u043B\u043E\u0432\u0435\u043A",
3632
- "\u0447\u0435\u0433\u043E",
3633
- "\u0440\u0430\u0437",
3634
- "\u0442\u043E\u0436\u0435",
3635
- "\u0441\u0435\u0431\u0435",
3636
- "\u043F\u043E\u0434",
3637
- "\u0436\u0438\u0437\u043D\u044C",
3638
- "\u0431\u0443\u0434\u0435\u0442",
3639
- "\u0436",
3640
- "\u0442\u043E\u0433\u0434\u0430",
3641
- "\u043A\u0442\u043E",
3642
- "\u044D\u0442\u043E\u0442",
3643
- "\u0433\u043E\u0432\u043E\u0440\u0438\u043B",
3644
- "\u0442\u043E\u0433\u043E",
3645
- "\u043F\u043E\u0442\u043E\u043C\u0443",
3646
- "\u044D\u0442\u043E\u0433\u043E",
3647
- "\u043A\u0430\u043A\u043E\u0439",
3648
- "\u0441\u043E\u0432\u0441\u0435\u043C",
3649
- "\u043D\u0438\u043C",
3650
- "\u0437\u0434\u0435\u0441\u044C",
3651
- "\u044D\u0442\u043E\u043C",
3652
- "\u043E\u0434\u0438\u043D",
3653
- "\u043F\u043E\u0447\u0442\u0438",
3654
- "\u043C\u043E\u0439",
3655
- "\u0442\u0435\u043C",
3656
- "\u0447\u0442\u043E\u0431\u044B",
3657
- "\u043D\u0435\u0435",
3658
- "\u043A\u0430\u0436\u0435\u0442\u0441\u044F",
3659
- "\u0441\u0435\u0439\u0447\u0430\u0441",
3660
- "\u0431\u044B\u043B\u0438",
3661
- "\u043A\u0443\u0434\u0430",
3662
- "\u0437\u0430\u0447\u0435\u043C",
3663
- "\u0441\u043A\u0430\u0437\u0430\u0442\u044C",
3664
- "\u0432\u0441\u0435\u0445",
3665
- "\u043D\u0438\u043A\u043E\u0433\u0434\u0430",
3666
- "\u0441\u0435\u0433\u043E\u0434\u043D\u044F",
3667
- "\u043C\u043E\u0436\u043D\u043E",
3668
- "\u043F\u0440\u0438",
3669
- "\u043D\u0430\u043A\u043E\u043D\u0435\u0446",
3670
- "\u0434\u0432\u0430",
3671
- "\u043E\u0431",
3672
- "\u0434\u0440\u0443\u0433\u043E\u0439",
3673
- "\u0445\u043E\u0442\u044C",
3674
- "\u043F\u043E\u0441\u043B\u0435",
3675
- "\u043D\u0430\u0434",
3676
- "\u0431\u043E\u043B\u044C\u0448\u0435",
3677
- "\u0442\u043E\u0442",
3678
- "\u0447\u0435\u0440\u0435\u0437",
3679
- "\u044D\u0442\u0438",
3680
- "\u043D\u0430\u0441",
3681
- "\u043F\u0440\u043E",
3682
- "\u0432\u0441\u0435\u0433\u043E",
3683
- "\u043D\u0438\u0445",
3684
- "\u043A\u0430\u043A\u0430\u044F",
3685
- "\u043C\u043D\u043E\u0433\u043E",
3686
- "\u0440\u0430\u0437\u0432\u0435",
3687
- "\u0441\u043A\u0430\u0437\u0430\u043B\u0430",
3688
- "\u0442\u0440\u0438",
3689
- "\u044D\u0442\u0443",
3690
- "\u043C\u043E\u044F",
3691
- "\u0432\u043F\u0440\u043E\u0447\u0435\u043C",
3692
- "\u0445\u043E\u0440\u043E\u0448\u043E",
3693
- "\u0441\u0432\u043E\u044E",
3694
- "\u044D\u0442\u043E\u0439",
3695
- "\u043F\u0435\u0440\u0435\u0434",
3696
- "\u0438\u043D\u043E\u0433\u0434\u0430",
3697
- "\u043B\u0443\u0447\u0448\u0435",
3698
- "\u0447\u0443\u0442\u044C",
3699
- "\u0442\u043E\u043C",
3700
- "\u043D\u0435\u043B\u044C\u0437\u044F",
3701
- "\u0442\u0430\u043A\u043E\u0439",
3702
- "\u0438\u043C",
3703
- "\u0431\u043E\u043B\u0435\u0435",
3704
- "\u0432\u0441\u0435\u0433\u0434\u0430",
3705
- "\u043A\u043E\u043D\u0435\u0447\u043D\u043E",
3706
- "\u0432\u0441\u044E",
3707
- "\u043C\u0435\u0436\u0434\u0443"
3708
- ];
3709
-
3710
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/no.js
3711
- var no = [
3712
- "og",
3713
- "i",
3714
- "jeg",
3715
- "det",
3716
- "at",
3717
- "en",
3718
- "et",
3719
- "den",
3720
- "til",
3721
- "er",
3722
- "som",
3723
- "p\xE5",
3724
- "de",
3725
- "med",
3726
- "han",
3727
- "av",
3728
- "ikke",
3729
- "ikkje",
3730
- "der",
3731
- "s\xE5",
3732
- "var",
3733
- "meg",
3734
- "seg",
3735
- "men",
3736
- "ett",
3737
- "har",
3738
- "om",
3739
- "vi",
3740
- "min",
3741
- "mitt",
3742
- "ha",
3743
- "hadde",
3744
- "hun",
3745
- "n\xE5",
3746
- "over",
3747
- "da",
3748
- "ved",
3749
- "fra",
3750
- "du",
3751
- "ut",
3752
- "sin",
3753
- "dem",
3754
- "oss",
3755
- "opp",
3756
- "man",
3757
- "kan",
3758
- "hans",
3759
- "hvor",
3760
- "eller",
3761
- "hva",
3762
- "skal",
3763
- "selv",
3764
- "sj\xF8l",
3765
- "her",
3766
- "alle",
3767
- "vil",
3768
- "bli",
3769
- "ble",
3770
- "blei",
3771
- "blitt",
3772
- "kunne",
3773
- "inn",
3774
- "n\xE5r",
3775
- "v\xE6re",
3776
- "kom",
3777
- "noen",
3778
- "noe",
3779
- "ville",
3780
- "dere",
3781
- "som",
3782
- "deres",
3783
- "kun",
3784
- "ja",
3785
- "etter",
3786
- "ned",
3787
- "skulle",
3788
- "denne",
3789
- "for",
3790
- "deg",
3791
- "si",
3792
- "sine",
3793
- "sitt",
3794
- "mot",
3795
- "\xE5",
3796
- "meget",
3797
- "hvorfor",
3798
- "dette",
3799
- "disse",
3800
- "uten",
3801
- "hvordan",
3802
- "ingen",
3803
- "din",
3804
- "ditt",
3805
- "blir",
3806
- "samme",
3807
- "hvilken",
3808
- "hvilke",
3809
- "s\xE5nn",
3810
- "inni",
3811
- "mellom",
3812
- "v\xE5r",
3813
- "hver",
3814
- "hvem",
3815
- "vors",
3816
- "hvis",
3817
- "b\xE5de",
3818
- "bare",
3819
- "enn",
3820
- "fordi",
3821
- "f\xF8r",
3822
- "mange",
3823
- "ogs\xE5",
3824
- "slik",
3825
- "v\xE6rt",
3826
- "v\xE6re",
3827
- "b\xE5e",
3828
- "begge",
3829
- "siden",
3830
- "dykk",
3831
- "dykkar",
3832
- "dei",
3833
- "deira",
3834
- "deires",
3835
- "deim",
3836
- "di",
3837
- "d\xE5",
3838
- "eg",
3839
- "ein",
3840
- "eit",
3841
- "eitt",
3842
- "elles",
3843
- "honom",
3844
- "hj\xE5",
3845
- "ho",
3846
- "hoe",
3847
- "henne",
3848
- "hennar",
3849
- "hennes",
3850
- "hoss",
3851
- "hossen",
3852
- "ikkje",
3853
- "ingi",
3854
- "inkje",
3855
- "korleis",
3856
- "korso",
3857
- "kva",
3858
- "kvar",
3859
- "kvarhelst",
3860
- "kven",
3861
- "kvi",
3862
- "kvifor",
3863
- "me",
3864
- "medan",
3865
- "mi",
3866
- "mine",
3867
- "mykje",
3868
- "no",
3869
- "nokon",
3870
- "noka",
3871
- "nokor",
3872
- "noko",
3873
- "nokre",
3874
- "si",
3875
- "sia",
3876
- "sidan",
3877
- "so",
3878
- "somt",
3879
- "somme",
3880
- "um",
3881
- "upp",
3882
- "vere",
3883
- "vore",
3884
- "verte",
3885
- "vort",
3886
- "varte",
3887
- "vart"
3888
- ];
3889
-
3890
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/de.js
3891
- var de = [
3892
- "aber",
3893
- "alle",
3894
- "allem",
3895
- "allen",
3896
- "aller",
3897
- "alles",
3898
- "als",
3899
- "also",
3900
- "am",
3901
- "an",
3902
- "ander",
3903
- "andere",
3904
- "anderem",
3905
- "anderen",
3906
- "anderer",
3907
- "anderes",
3908
- "anderm",
3909
- "andern",
3910
- "anderr",
3911
- "anders",
3912
- "auch",
3913
- "auf",
3914
- "aus",
3915
- "bei",
3916
- "bin",
3917
- "bis",
3918
- "bist",
3919
- "da",
3920
- "damit",
3921
- "dann",
3922
- "der",
3923
- "den",
3924
- "des",
3925
- "dem",
3926
- "die",
3927
- "das",
3928
- "da\xDF",
3929
- "derselbe",
3930
- "derselben",
3931
- "denselben",
3932
- "desselben",
3933
- "demselben",
3934
- "dieselbe",
3935
- "dieselben",
3936
- "dasselbe",
3937
- "dazu",
3938
- "dein",
3939
- "deine",
3940
- "deinem",
3941
- "deinen",
3942
- "deiner",
3943
- "deines",
3944
- "denn",
3945
- "derer",
3946
- "dessen",
3947
- "dich",
3948
- "dir",
3949
- "du",
3950
- "dies",
3951
- "diese",
3952
- "diesem",
3953
- "diesen",
3954
- "dieser",
3955
- "dieses",
3956
- "doch",
3957
- "dort",
3958
- "durch",
3959
- "ein",
3960
- "eine",
3961
- "einem",
3962
- "einen",
3963
- "einer",
3964
- "eines",
3965
- "einig",
3966
- "einige",
3967
- "einigem",
3968
- "einigen",
3969
- "einiger",
3970
- "einiges",
3971
- "einmal",
3972
- "er",
3973
- "ihn",
3974
- "ihm",
3975
- "es",
3976
- "etwas",
3977
- "euer",
3978
- "eure",
3979
- "eurem",
3980
- "euren",
3981
- "eurer",
3982
- "eures",
3983
- "f\xFCr",
3984
- "gegen",
3985
- "gewesen",
3986
- "hab",
3987
- "habe",
3988
- "haben",
3989
- "hat",
3990
- "hatte",
3991
- "hatten",
3992
- "hier",
3993
- "hin",
3994
- "hinter",
3995
- "ich",
3996
- "mich",
3997
- "mir",
3998
- "ihr",
3999
- "ihre",
4000
- "ihrem",
4001
- "ihren",
4002
- "ihrer",
4003
- "ihres",
4004
- "euch",
4005
- "im",
4006
- "in",
4007
- "indem",
4008
- "ins",
4009
- "ist",
4010
- "jede",
4011
- "jedem",
4012
- "jeden",
4013
- "jeder",
4014
- "jedes",
4015
- "jene",
4016
- "jenem",
4017
- "jenen",
4018
- "jener",
4019
- "jenes",
4020
- "jetzt",
4021
- "kann",
4022
- "kein",
4023
- "keine",
4024
- "keinem",
4025
- "keinen",
4026
- "keiner",
4027
- "keines",
4028
- "k\xF6nnen",
4029
- "k\xF6nnte",
4030
- "machen",
4031
- "man",
4032
- "manche",
4033
- "manchem",
4034
- "manchen",
4035
- "mancher",
4036
- "manches",
4037
- "mein",
4038
- "meine",
4039
- "meinem",
4040
- "meinen",
4041
- "meiner",
4042
- "meines",
4043
- "mit",
4044
- "muss",
4045
- "musste",
4046
- "nach",
4047
- "nicht",
4048
- "nichts",
4049
- "noch",
4050
- "nun",
4051
- "nur",
4052
- "ob",
4053
- "oder",
4054
- "ohne",
4055
- "sehr",
4056
- "sein",
4057
- "seine",
4058
- "seinem",
4059
- "seinen",
4060
- "seiner",
4061
- "seines",
4062
- "selbst",
4063
- "sich",
4064
- "sie",
4065
- "ihnen",
4066
- "sind",
4067
- "so",
4068
- "solche",
4069
- "solchem",
4070
- "solchen",
4071
- "solcher",
4072
- "solches",
4073
- "soll",
4074
- "sollte",
4075
- "sondern",
4076
- "sonst",
4077
- "\xFCber",
4078
- "um",
4079
- "und",
4080
- "uns",
4081
- "unse",
4082
- "unsem",
4083
- "unsen",
4084
- "unser",
4085
- "unses",
4086
- "unter",
4087
- "viel",
4088
- "vom",
4089
- "von",
4090
- "vor",
4091
- "w\xE4hrend",
4092
- "war",
4093
- "waren",
4094
- "warst",
4095
- "was",
4096
- "weg",
4097
- "weil",
4098
- "weiter",
4099
- "welche",
4100
- "welchem",
4101
- "welchen",
4102
- "welcher",
4103
- "welches",
4104
- "wenn",
4105
- "werde",
4106
- "werden",
4107
- "wie",
4108
- "wieder",
4109
- "will",
4110
- "wir",
4111
- "wird",
4112
- "wirst",
4113
- "wo",
4114
- "wollen",
4115
- "wollte",
4116
- "w\xFCrde",
4117
- "w\xFCrden",
4118
- "zu",
4119
- "zum",
4120
- "zur",
4121
- "zwar",
4122
- "zwischen"
4123
- ];
4124
-
4125
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/dk.js
4126
- var dk = [
4127
- "og",
4128
- "i",
4129
- "jeg",
4130
- "det",
4131
- "at",
4132
- "en",
4133
- "den",
4134
- "til",
4135
- "er",
4136
- "som",
4137
- "p\xE5",
4138
- "de",
4139
- "med",
4140
- "han",
4141
- "af",
4142
- "for",
4143
- "ikke",
4144
- "der",
4145
- "var",
4146
- "mig",
4147
- "sig",
4148
- "men",
4149
- "et",
4150
- "har",
4151
- "om",
4152
- "vi",
4153
- "min",
4154
- "havde",
4155
- "ham",
4156
- "hun",
4157
- "nu",
4158
- "over",
4159
- "da",
4160
- "fra",
4161
- "du",
4162
- "ud",
4163
- "sin",
4164
- "dem",
4165
- "os",
4166
- "op",
4167
- "man",
4168
- "hans",
4169
- "hvor",
4170
- "eller",
4171
- "hvad",
4172
- "skal",
4173
- "selv",
4174
- "her",
4175
- "alle",
4176
- "vil",
4177
- "blev",
4178
- "kunne",
4179
- "ind",
4180
- "n\xE5r",
4181
- "v\xE6re",
4182
- "dog",
4183
- "noget",
4184
- "ville",
4185
- "jo",
4186
- "deres",
4187
- "efter",
4188
- "ned",
4189
- "skulle",
4190
- "denne",
4191
- "end",
4192
- "dette",
4193
- "mit",
4194
- "ogs\xE5",
4195
- "under",
4196
- "have",
4197
- "dig",
4198
- "anden",
4199
- "hende",
4200
- "mine",
4201
- "alt",
4202
- "meget",
4203
- "sit",
4204
- "sine",
4205
- "vor",
4206
- "mod",
4207
- "disse",
4208
- "hvis",
4209
- "din",
4210
- "nogle",
4211
- "hos",
4212
- "blive",
4213
- "mange",
4214
- "ad",
4215
- "bliver",
4216
- "hendes",
4217
- "v\xE6ret",
4218
- "thi",
4219
- "jer",
4220
- "s\xE5dan"
4221
- ];
4222
-
4223
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/fi.js
4224
- var fi = [
4225
- "olla",
4226
- "olen",
4227
- "olet",
4228
- "on",
4229
- "olemme",
4230
- "olette",
4231
- "ovat",
4232
- "ole",
4233
- "oli",
4234
- "olisi",
4235
- "olisit",
4236
- "olisin",
4237
- "olisimme",
4238
- "olisitte",
4239
- "olisivat",
4240
- "olit",
4241
- "olin",
4242
- "olimme",
4243
- "olitte",
4244
- "olivat",
4245
- "ollut",
4246
- "olleet",
4247
- "en",
4248
- "et",
4249
- "ei",
4250
- "emme",
4251
- "ette",
4252
- "eiv\xE4t",
4253
- "min\xE4",
4254
- "minun",
4255
- "minut",
4256
- "minua",
4257
- "minussa",
4258
- "minusta",
4259
- "minuun",
4260
- "minulla",
4261
- "minulta",
4262
- "minulle",
4263
- "sin\xE4",
4264
- "sinun",
4265
- "sinut",
4266
- "sinua",
4267
- "sinussa",
4268
- "sinusta",
4269
- "sinuun",
4270
- "sinulla",
4271
- "sinulta",
4272
- "sinulle",
4273
- "h\xE4n",
4274
- "h\xE4nen",
4275
- "h\xE4net",
4276
- "h\xE4nt\xE4",
4277
- "h\xE4ness\xE4",
4278
- "h\xE4nest\xE4",
4279
- "h\xE4neen",
4280
- "h\xE4nell\xE4",
4281
- "h\xE4nelt\xE4",
4282
- "h\xE4nelle",
4283
- "me",
4284
- "meid\xE4n",
4285
- "meid\xE4t",
4286
- "meit\xE4",
4287
- "meiss\xE4",
4288
- "meist\xE4",
4289
- "meihin",
4290
- "meill\xE4",
4291
- "meilt\xE4",
4292
- "meille",
4293
- "te",
4294
- "teid\xE4n",
4295
- "teid\xE4t",
4296
- "teit\xE4",
4297
- "teiss\xE4",
4298
- "teist\xE4",
4299
- "teihin",
4300
- "teill\xE4",
4301
- "teilt\xE4",
4302
- "teille",
4303
- "he",
4304
- "heid\xE4n",
4305
- "heid\xE4t",
4306
- "heit\xE4",
4307
- "heiss\xE4",
4308
- "heist\xE4",
4309
- "heihin",
4310
- "heill\xE4",
4311
- "heilt\xE4",
4312
- "heille",
4313
- "t\xE4m\xE4",
4314
- "t\xE4m\xE4n",
4315
- "t\xE4t\xE4",
4316
- "t\xE4ss\xE4",
4317
- "t\xE4st\xE4",
4318
- "t\xE4h\xE4n",
4319
- "t\xE4ll\xE4",
4320
- "t\xE4lt\xE4",
4321
- "t\xE4lle",
4322
- "t\xE4n\xE4",
4323
- "t\xE4ksi",
4324
- "tuo",
4325
- "tuon",
4326
- "tuota",
4327
- "tuossa",
4328
- "tuosta",
4329
- "tuohon",
4330
- "tuolla",
4331
- "tuolta",
4332
- "tuolle",
4333
- "tuona",
4334
- "tuoksi",
4335
- "se",
4336
- "sen",
4337
- "sit\xE4",
4338
- "siin\xE4",
4339
- "siit\xE4",
4340
- "siihen",
4341
- "sill\xE4",
4342
- "silt\xE4",
4343
- "sille",
4344
- "sin\xE4",
4345
- "siksi",
4346
- "n\xE4m\xE4",
4347
- "n\xE4iden",
4348
- "n\xE4it\xE4",
4349
- "n\xE4iss\xE4",
4350
- "n\xE4ist\xE4",
4351
- "n\xE4ihin",
4352
- "n\xE4ill\xE4",
4353
- "n\xE4ilt\xE4",
4354
- "n\xE4ille",
4355
- "n\xE4in\xE4",
4356
- "n\xE4iksi",
4357
- "nuo",
4358
- "noiden",
4359
- "noita",
4360
- "noissa",
4361
- "noista",
4362
- "noihin",
4363
- "noilla",
4364
- "noilta",
4365
- "noille",
4366
- "noina",
4367
- "noiksi",
4368
- "ne",
4369
- "niiden",
4370
- "niit\xE4",
4371
- "niiss\xE4",
4372
- "niist\xE4",
4373
- "niihin",
4374
- "niill\xE4",
4375
- "niilt\xE4",
4376
- "niille",
4377
- "niin\xE4",
4378
- "niiksi",
4379
- "kuka",
4380
- "kenen",
4381
- "kenet",
4382
- "ket\xE4",
4383
- "keness\xE4",
4384
- "kenest\xE4",
4385
- "keneen",
4386
- "kenell\xE4",
4387
- "kenelt\xE4",
4388
- "kenelle",
4389
- "kenen\xE4",
4390
- "keneksi",
4391
- "ketk\xE4",
4392
- "keiden",
4393
- "ketk\xE4",
4394
- "keit\xE4",
4395
- "keiss\xE4",
4396
- "keist\xE4",
4397
- "keihin",
4398
- "keill\xE4",
4399
- "keilt\xE4",
4400
- "keille",
4401
- "kein\xE4",
4402
- "keiksi",
4403
- "mik\xE4",
4404
- "mink\xE4",
4405
- "mink\xE4",
4406
- "mit\xE4",
4407
- "miss\xE4",
4408
- "mist\xE4",
4409
- "mihin",
4410
- "mill\xE4",
4411
- "milt\xE4",
4412
- "mille",
4413
- "min\xE4",
4414
- "miksi",
4415
- "mitk\xE4",
4416
- "joka",
4417
- "jonka",
4418
- "jota",
4419
- "jossa",
4420
- "josta",
4421
- "johon",
4422
- "jolla",
4423
- "jolta",
4424
- "jolle",
4425
- "jona",
4426
- "joksi",
4427
- "jotka",
4428
- "joiden",
4429
- "joita",
4430
- "joissa",
4431
- "joista",
4432
- "joihin",
4433
- "joilla",
4434
- "joilta",
4435
- "joille",
4436
- "joina",
4437
- "joiksi",
4438
- "ett\xE4",
4439
- "ja",
4440
- "jos",
4441
- "koska",
4442
- "kuin",
4443
- "mutta",
4444
- "niin",
4445
- "sek\xE4",
4446
- "sill\xE4",
4447
- "tai",
4448
- "vaan",
4449
- "vai",
4450
- "vaikka",
4451
- "kanssa",
4452
- "mukaan",
4453
- "noin",
4454
- "poikki",
4455
- "yli",
4456
- "kun",
4457
- "niin",
4458
- "nyt",
4459
- "itse"
4460
- ];
4461
-
4462
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/stop-words/index.js
4463
- var stopWords = {
4464
- english: en,
4465
- italian: it,
4466
- french: fr,
4467
- spanish: es,
4468
- portuguese: pt,
4469
- dutch: nl,
4470
- swedish: se,
4471
- russian: ru,
4472
- norwegian: no,
4473
- german: de,
4474
- danish: dk,
4475
- finnish: fi
4476
- };
4477
- var availableStopWords = Object.keys(stopWords);
4478
-
4479
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/english-stemmer.js
2383
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/tokenizer/english-stemmer.js
4480
2384
  var step2List = {
4481
2385
  ational: "ate",
4482
2386
  tional: "tion",
@@ -4636,7 +2540,7 @@ function stemmer(w) {
4636
2540
  return w;
4637
2541
  }
4638
2542
 
4639
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/index.js
2543
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/tokenizer/index.js
4640
2544
  function normalizeToken(prop, token) {
4641
2545
  var _this_stopWords;
4642
2546
  const key = `${this.language}:${prop}:${token}`;
@@ -4681,7 +2585,6 @@ function tokenize(input, language, prop) {
4681
2585
  return trimTokens;
4682
2586
  }
4683
2587
  async function createTokenizer(config = {}) {
4684
- var _a2;
4685
2588
  if (!config.language) {
4686
2589
  config.language = "english";
4687
2590
  } else if (!SUPPORTED_LANGUAGES.includes(config.language)) {
@@ -4702,20 +2605,20 @@ async function createTokenizer(config = {}) {
4702
2605
  }
4703
2606
  }
4704
2607
  }
4705
- let stopWords2;
2608
+ let stopWords;
4706
2609
  if (config.stopWords !== false) {
4707
- stopWords2 = (_a2 = stopWords[config.language]) != null ? _a2 : [];
2610
+ stopWords = [];
4708
2611
  if (Array.isArray(config.stopWords)) {
4709
- stopWords2 = config.stopWords;
2612
+ stopWords = config.stopWords;
4710
2613
  } else if (typeof config.stopWords === "function") {
4711
- stopWords2 = await config.stopWords(stopWords2);
2614
+ stopWords = await config.stopWords(stopWords);
4712
2615
  } else if (config.stopWords) {
4713
2616
  throw createError("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");
4714
2617
  }
4715
- if (!Array.isArray(stopWords2)) {
2618
+ if (!Array.isArray(stopWords)) {
4716
2619
  throw createError("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");
4717
2620
  }
4718
- for (const s of stopWords2) {
2621
+ for (const s of stopWords) {
4719
2622
  if (typeof s !== "string") {
4720
2623
  throw createError("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");
4721
2624
  }
@@ -4728,7 +2631,7 @@ async function createTokenizer(config = {}) {
4728
2631
  stemmerSkipProperties: new Set(config.stemmerSkipProperties ? [
4729
2632
  config.stemmerSkipProperties
4730
2633
  ].flat() : []),
4731
- stopWords: stopWords2,
2634
+ stopWords,
4732
2635
  allowDuplicates: Boolean(config.allowDuplicates),
4733
2636
  normalizeToken,
4734
2637
  normalizationCache: /* @__PURE__ */ new Map()
@@ -4738,7 +2641,255 @@ async function createTokenizer(config = {}) {
4738
2641
  return tokenizer;
4739
2642
  }
4740
2643
 
4741
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/methods/create.js
2644
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/sorter.js
2645
+ function innerCreate(orama, sharedInternalDocumentStore, schema, sortableDeniedProperties, prefix) {
2646
+ const sorter = {
2647
+ language: orama.tokenizer.language,
2648
+ sharedInternalDocumentStore,
2649
+ enabled: true,
2650
+ isSorted: true,
2651
+ sortableProperties: [],
2652
+ sortablePropertiesWithTypes: {},
2653
+ sorts: {}
2654
+ };
2655
+ for (const [prop, type] of Object.entries(schema)) {
2656
+ const typeActualType = typeof type;
2657
+ const path = `${prefix}${prefix ? "." : ""}${prop}`;
2658
+ if (sortableDeniedProperties.includes(path)) {
2659
+ continue;
2660
+ }
2661
+ if (typeActualType === "object" && !Array.isArray(type)) {
2662
+ const ret = innerCreate(orama, sharedInternalDocumentStore, type, sortableDeniedProperties, path);
2663
+ sorter.sortableProperties.push(...ret.sortableProperties);
2664
+ sorter.sorts = __spreadValues(__spreadValues({}, sorter.sorts), ret.sorts);
2665
+ sorter.sortablePropertiesWithTypes = __spreadValues(__spreadValues({}, sorter.sortablePropertiesWithTypes), ret.sortablePropertiesWithTypes);
2666
+ continue;
2667
+ }
2668
+ switch (type) {
2669
+ case "boolean":
2670
+ case "number":
2671
+ case "string":
2672
+ sorter.sortableProperties.push(path);
2673
+ sorter.sortablePropertiesWithTypes[path] = type;
2674
+ sorter.sorts[path] = {
2675
+ docs: /* @__PURE__ */ new Map(),
2676
+ orderedDocsToRemove: /* @__PURE__ */ new Map(),
2677
+ orderedDocs: [],
2678
+ type
2679
+ };
2680
+ break;
2681
+ case "boolean[]":
2682
+ case "number[]":
2683
+ case "string[]":
2684
+ continue;
2685
+ default:
2686
+ throw createError("INVALID_SORT_SCHEMA_TYPE", Array.isArray(type) ? "array" : type, path);
2687
+ }
2688
+ }
2689
+ return sorter;
2690
+ }
2691
+ async function create5(orama, sharedInternalDocumentStore, schema, config) {
2692
+ const isSortEnabled = (config === null || config === void 0 ? void 0 : config.enabled) !== false;
2693
+ if (!isSortEnabled) {
2694
+ return {
2695
+ disabled: true
2696
+ };
2697
+ }
2698
+ return innerCreate(orama, sharedInternalDocumentStore, schema, (config || {}).unsortableProperties || [], "");
2699
+ }
2700
+ async function insert4(sorter, prop, id, value) {
2701
+ if (!sorter.enabled) {
2702
+ return;
2703
+ }
2704
+ sorter.isSorted = false;
2705
+ const internalId = getInternalDocumentId(sorter.sharedInternalDocumentStore, id);
2706
+ const s = sorter.sorts[prop];
2707
+ s.docs.set(internalId, s.orderedDocs.length);
2708
+ s.orderedDocs.push([
2709
+ internalId,
2710
+ value
2711
+ ]);
2712
+ }
2713
+ function ensureIsSorted(sorter) {
2714
+ if (sorter.isSorted) {
2715
+ return;
2716
+ }
2717
+ if (!sorter.enabled) {
2718
+ return;
2719
+ }
2720
+ const properties = Object.keys(sorter.sorts);
2721
+ for (const prop of properties) {
2722
+ ensurePropertyIsSorted(sorter, prop);
2723
+ }
2724
+ sorter.isSorted = true;
2725
+ }
2726
+ function stringSort(language, value, d) {
2727
+ return value[1].localeCompare(d[1], language);
2728
+ }
2729
+ function numberSort(value, d) {
2730
+ return value[1] - d[1];
2731
+ }
2732
+ function booleanSort(value, d) {
2733
+ return d[1] ? -1 : 1;
2734
+ }
2735
+ function ensurePropertyIsSorted(sorter, prop) {
2736
+ const s = sorter.sorts[prop];
2737
+ let predicate;
2738
+ switch (s.type) {
2739
+ case "string":
2740
+ predicate = stringSort.bind(null, sorter.language);
2741
+ break;
2742
+ case "number":
2743
+ predicate = numberSort.bind(null);
2744
+ break;
2745
+ case "boolean":
2746
+ predicate = booleanSort.bind(null);
2747
+ break;
2748
+ }
2749
+ s.orderedDocs.sort(predicate);
2750
+ const orderedDocsLength = s.orderedDocs.length;
2751
+ for (let i = 0; i < orderedDocsLength; i++) {
2752
+ const docId = s.orderedDocs[i][0];
2753
+ s.docs.set(docId, i);
2754
+ }
2755
+ }
2756
+ function ensureOrderedDocsAreDeleted(sorter) {
2757
+ const properties = Object.keys(sorter.sorts);
2758
+ for (const prop of properties) {
2759
+ ensureOrderedDocsAreDeletedByProperty(sorter, prop);
2760
+ }
2761
+ }
2762
+ function ensureOrderedDocsAreDeletedByProperty(sorter, prop) {
2763
+ const s = sorter.sorts[prop];
2764
+ if (!s.orderedDocsToRemove.size)
2765
+ return;
2766
+ s.orderedDocs = s.orderedDocs.filter((doc) => !s.orderedDocsToRemove.has(doc[0]));
2767
+ s.orderedDocsToRemove.clear();
2768
+ }
2769
+ async function remove4(sorter, prop, id) {
2770
+ if (!sorter.enabled) {
2771
+ return;
2772
+ }
2773
+ const s = sorter.sorts[prop];
2774
+ const internalId = getInternalDocumentId(sorter.sharedInternalDocumentStore, id);
2775
+ const index = s.docs.get(internalId);
2776
+ if (!index)
2777
+ return;
2778
+ s.docs.delete(internalId);
2779
+ s.orderedDocsToRemove.set(internalId, true);
2780
+ }
2781
+ async function sortBy(sorter, docIds, by) {
2782
+ if (!sorter.enabled) {
2783
+ throw createError("SORT_DISABLED");
2784
+ }
2785
+ const property = by.property;
2786
+ const isDesc = by.order === "DESC";
2787
+ const s = sorter.sorts[property];
2788
+ if (!s) {
2789
+ throw createError("UNABLE_TO_SORT_ON_UNKNOWN_FIELD", property, sorter.sortableProperties.join(", "));
2790
+ }
2791
+ ensureOrderedDocsAreDeletedByProperty(sorter, property);
2792
+ ensureIsSorted(sorter);
2793
+ docIds.sort((a, b) => {
2794
+ const indexOfA = s.docs.get(getInternalDocumentId(sorter.sharedInternalDocumentStore, a[0]));
2795
+ const indexOfB = s.docs.get(getInternalDocumentId(sorter.sharedInternalDocumentStore, b[0]));
2796
+ const isAIndexed = typeof indexOfA !== "undefined";
2797
+ const isBIndexed = typeof indexOfB !== "undefined";
2798
+ if (!isAIndexed && !isBIndexed) {
2799
+ return 0;
2800
+ }
2801
+ if (!isAIndexed) {
2802
+ return 1;
2803
+ }
2804
+ if (!isBIndexed) {
2805
+ return -1;
2806
+ }
2807
+ return isDesc ? indexOfB - indexOfA : indexOfA - indexOfB;
2808
+ });
2809
+ return docIds;
2810
+ }
2811
+ async function getSortableProperties(sorter) {
2812
+ if (!sorter.enabled) {
2813
+ return [];
2814
+ }
2815
+ return sorter.sortableProperties;
2816
+ }
2817
+ async function getSortablePropertiesWithTypes(sorter) {
2818
+ if (!sorter.enabled) {
2819
+ return {};
2820
+ }
2821
+ return sorter.sortablePropertiesWithTypes;
2822
+ }
2823
+ async function load4(sharedInternalDocumentStore, raw) {
2824
+ const rawDocument = raw;
2825
+ if (!rawDocument.enabled) {
2826
+ return {
2827
+ enabled: false
2828
+ };
2829
+ }
2830
+ const sorts = Object.keys(rawDocument.sorts).reduce((acc, prop) => {
2831
+ const { docs, orderedDocs, type } = rawDocument.sorts[prop];
2832
+ acc[prop] = {
2833
+ docs: new Map(Object.entries(docs).map(([k, v2]) => [
2834
+ +k,
2835
+ v2
2836
+ ])),
2837
+ orderedDocsToRemove: /* @__PURE__ */ new Map(),
2838
+ orderedDocs,
2839
+ type
2840
+ };
2841
+ return acc;
2842
+ }, {});
2843
+ return {
2844
+ sharedInternalDocumentStore,
2845
+ language: rawDocument.language,
2846
+ sortableProperties: rawDocument.sortableProperties,
2847
+ sortablePropertiesWithTypes: rawDocument.sortablePropertiesWithTypes,
2848
+ sorts,
2849
+ enabled: true,
2850
+ isSorted: rawDocument.isSorted
2851
+ };
2852
+ }
2853
+ async function save4(sorter) {
2854
+ if (!sorter.enabled) {
2855
+ return {
2856
+ enabled: false
2857
+ };
2858
+ }
2859
+ ensureOrderedDocsAreDeleted(sorter);
2860
+ ensureIsSorted(sorter);
2861
+ const sorts = Object.keys(sorter.sorts).reduce((acc, prop) => {
2862
+ const { docs, orderedDocs, type } = sorter.sorts[prop];
2863
+ acc[prop] = {
2864
+ docs: Object.fromEntries(docs.entries()),
2865
+ orderedDocs,
2866
+ type
2867
+ };
2868
+ return acc;
2869
+ }, {});
2870
+ return {
2871
+ language: sorter.language,
2872
+ sortableProperties: sorter.sortableProperties,
2873
+ sortablePropertiesWithTypes: sorter.sortablePropertiesWithTypes,
2874
+ sorts,
2875
+ enabled: sorter.enabled,
2876
+ isSorted: sorter.isSorted
2877
+ };
2878
+ }
2879
+ async function createSorter() {
2880
+ return {
2881
+ create: create5,
2882
+ insert: insert4,
2883
+ remove: remove4,
2884
+ save: save4,
2885
+ load: load4,
2886
+ sortBy,
2887
+ getSortableProperties,
2888
+ getSortablePropertiesWithTypes
2889
+ };
2890
+ }
2891
+
2892
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/methods/create.js
4742
2893
  function validateComponents(components) {
4743
2894
  const defaultComponents = {
4744
2895
  formatElapsedTime,
@@ -4758,7 +2909,8 @@ function validateComponents(components) {
4758
2909
  }
4759
2910
  for (const rawKey of SINGLE_OR_ARRAY_COMPONENTS) {
4760
2911
  const key = rawKey;
4761
- if (!components[key]) {
2912
+ const component = components[key];
2913
+ if (!component) {
4762
2914
  components[key] = [];
4763
2915
  } else if (!Array.isArray(components[key])) {
4764
2916
  components[key] = [
@@ -4777,7 +2929,7 @@ function validateComponents(components) {
4777
2929
  }
4778
2930
  }
4779
2931
  }
4780
- async function create5({ schema, language, components, id }) {
2932
+ async function create6({ schema, sort, language, components, id }) {
4781
2933
  if (!components) {
4782
2934
  components = {};
4783
2935
  }
@@ -4787,6 +2939,7 @@ async function create5({ schema, language, components, id }) {
4787
2939
  let tokenizer = components.tokenizer;
4788
2940
  let index = components.index;
4789
2941
  let documentsStore = components.documentsStore;
2942
+ let sorter = components.sorter;
4790
2943
  if (!tokenizer) {
4791
2944
  tokenizer = await createTokenizer({
4792
2945
  language: language != null ? language : "english"
@@ -4797,21 +2950,21 @@ async function create5({ schema, language, components, id }) {
4797
2950
  if (components.tokenizer && language) {
4798
2951
  throw createError("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");
4799
2952
  }
4800
- if (!index) {
4801
- index = await createIndex();
4802
- }
4803
- if (!documentsStore) {
4804
- documentsStore = await createDocumentsStore();
4805
- }
2953
+ const internalDocumentStore = createInternalDocumentIDStore();
2954
+ index || (index = await createIndex());
2955
+ sorter || (sorter = await createSorter());
2956
+ documentsStore || (documentsStore = await createDocumentsStore());
4806
2957
  validateComponents(components);
4807
- const { getDocumentProperties: getDocumentProperties2, getDocumentIndexId: getDocumentIndexId2, validateSchema: validateSchema2, beforeInsert, afterInsert, beforeRemove, afterRemove, beforeMultipleInsert, afterMultipleInsert, beforeMultipleRemove, afterMultipleRemove, formatElapsedTime: formatElapsedTime2 } = components;
2958
+ const { getDocumentProperties: getDocumentProperties2, getDocumentIndexId: getDocumentIndexId2, validateSchema: validateSchema2, beforeInsert, afterInsert, beforeRemove, afterRemove, beforeUpdate, afterUpdate, afterSearch, beforeMultipleInsert, afterMultipleInsert, beforeMultipleRemove, afterMultipleRemove, beforeMultipleUpdate, afterMultipleUpdate, formatElapsedTime: formatElapsedTime2 } = components;
4808
2959
  const orama = {
4809
2960
  data: {},
4810
2961
  caches: {},
4811
2962
  schema,
4812
2963
  tokenizer,
4813
2964
  index,
2965
+ sorter,
4814
2966
  documentsStore,
2967
+ internalDocumentIDStore: internalDocumentStore,
4815
2968
  getDocumentProperties: getDocumentProperties2,
4816
2969
  getDocumentIndexId: getDocumentIndexId2,
4817
2970
  validateSchema: validateSchema2,
@@ -4819,25 +2972,31 @@ async function create5({ schema, language, components, id }) {
4819
2972
  afterInsert,
4820
2973
  beforeRemove,
4821
2974
  afterRemove,
2975
+ beforeUpdate,
2976
+ afterUpdate,
2977
+ afterSearch,
4822
2978
  beforeMultipleInsert,
4823
2979
  afterMultipleInsert,
4824
2980
  beforeMultipleRemove,
4825
2981
  afterMultipleRemove,
2982
+ beforeMultipleUpdate,
2983
+ afterMultipleUpdate,
4826
2984
  formatElapsedTime: formatElapsedTime2,
4827
2985
  id
4828
2986
  };
4829
2987
  orama.data = {
4830
- index: await orama.index.create(orama, schema),
4831
- docs: await orama.documentsStore.create(orama)
2988
+ index: await orama.index.create(orama, internalDocumentStore, schema),
2989
+ docs: await orama.documentsStore.create(orama, internalDocumentStore),
2990
+ sorting: await orama.sorter.create(orama, internalDocumentStore, schema, sort)
4832
2991
  };
4833
2992
  return orama;
4834
2993
  }
4835
2994
 
4836
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/types.js
2995
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/types.js
4837
2996
  var kInsertions = Symbol("orama.insertions");
4838
2997
  var kRemovals = Symbol("orama.removals");
4839
2998
 
4840
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/sync-blocking-checker.js
2999
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/sync-blocking-checker.js
4841
3000
  var _globalThis_process;
4842
3001
  var _a;
4843
3002
  var warn = (_a = (_globalThis_process = globalThis.process) === null || _globalThis_process === void 0 ? void 0 : _globalThis_process.emitWarning) != null ? _a : function emitWarning(message, options) {
@@ -4876,9 +3035,15 @@ function trackRemoval(orama) {
4876
3035
  }
4877
3036
  }
4878
3037
 
4879
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/methods/insert.js
4880
- async function insert4(orama, doc, language, skipHooks) {
4881
- await orama.validateSchema(doc, orama.schema);
3038
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/methods/insert.js
3039
+ async function insert5(orama, doc, language, skipHooks) {
3040
+ const errorProperty = await orama.validateSchema(doc, orama.schema);
3041
+ if (errorProperty) {
3042
+ throw createError("SCHEMA_VALIDATION_FAILURE", errorProperty);
3043
+ }
3044
+ return innerInsert(orama, doc, language, skipHooks);
3045
+ }
3046
+ async function innerInsert(orama, doc, language, skipHooks) {
4882
3047
  const { index, docs } = orama.data;
4883
3048
  const id = await orama.getDocumentIndexId(doc);
4884
3049
  if (typeof id !== "string") {
@@ -4893,26 +3058,41 @@ async function insert4(orama, doc, language, skipHooks) {
4893
3058
  }
4894
3059
  const indexableProperties = await orama.index.getSearchableProperties(index);
4895
3060
  const indexablePropertiesWithTypes = await orama.index.getSearchablePropertiesWithTypes(index);
4896
- const values = await orama.getDocumentProperties(doc, indexableProperties);
4897
- for (const [key, value] of Object.entries(values)) {
3061
+ const indexableValues = await orama.getDocumentProperties(doc, indexableProperties);
3062
+ for (const [key, value] of Object.entries(indexableValues)) {
4898
3063
  if (typeof value === "undefined") {
4899
3064
  continue;
4900
3065
  }
4901
3066
  const actualType = typeof value;
4902
3067
  const expectedType = indexablePropertiesWithTypes[key];
3068
+ if (isArrayType(expectedType) && Array.isArray(value)) {
3069
+ continue;
3070
+ }
4903
3071
  if (actualType !== expectedType) {
4904
3072
  throw createError("INVALID_DOCUMENT_PROPERTY", key, expectedType, actualType);
4905
3073
  }
4906
3074
  }
4907
3075
  for (const prop of indexableProperties) {
4908
3076
  var _orama_index, _orama_index_beforeInsert, _orama_index1, _orama_index_afterInsert;
4909
- const value = values[prop];
3077
+ const value = indexableValues[prop];
3078
+ if (typeof value === "undefined") {
3079
+ continue;
3080
+ }
3081
+ const expectedType = indexablePropertiesWithTypes[prop];
3082
+ await ((_orama_index_beforeInsert = (_orama_index = orama.index).beforeInsert) === null || _orama_index_beforeInsert === void 0 ? void 0 : _orama_index_beforeInsert.call(_orama_index, orama.data.index, prop, id, value, expectedType, language, orama.tokenizer, docsCount));
3083
+ await orama.index.insert(orama.index, orama.data.index, prop, id, value, expectedType, language, orama.tokenizer, docsCount);
3084
+ await ((_orama_index_afterInsert = (_orama_index1 = orama.index).afterInsert) === null || _orama_index_afterInsert === void 0 ? void 0 : _orama_index_afterInsert.call(_orama_index1, orama.data.index, prop, id, value, expectedType, language, orama.tokenizer, docsCount));
3085
+ }
3086
+ const sortableProperties = await orama.sorter.getSortableProperties(orama.data.sorting);
3087
+ const sortablePropertiesWithTypes = await orama.sorter.getSortablePropertiesWithTypes(orama.data.sorting);
3088
+ const sortableValues = await orama.getDocumentProperties(doc, sortableProperties);
3089
+ for (const prop of sortableProperties) {
3090
+ const value = sortableValues[prop];
4910
3091
  if (typeof value === "undefined") {
4911
3092
  continue;
4912
3093
  }
4913
- await ((_orama_index_beforeInsert = (_orama_index = orama.index).beforeInsert) === null || _orama_index_beforeInsert === void 0 ? void 0 : _orama_index_beforeInsert.call(_orama_index, orama.data.index, prop, id, value, language, orama.tokenizer, docsCount));
4914
- await orama.index.insert(orama.index, orama.data.index, prop, id, value, language, orama.tokenizer, docsCount);
4915
- await ((_orama_index_afterInsert = (_orama_index1 = orama.index).afterInsert) === null || _orama_index_afterInsert === void 0 ? void 0 : _orama_index_afterInsert.call(_orama_index1, orama.data.index, prop, id, value, language, orama.tokenizer, docsCount));
3094
+ const expectedType = sortablePropertiesWithTypes[prop];
3095
+ await orama.sorter.insert(orama.data.sorting, prop, id, value, expectedType, language);
4916
3096
  }
4917
3097
  if (!skipHooks) {
4918
3098
  await runSingleHook(orama.afterInsert, orama, id, doc);
@@ -4921,37 +3101,52 @@ async function insert4(orama, doc, language, skipHooks) {
4921
3101
  return id;
4922
3102
  }
4923
3103
 
4924
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/methods/remove.js
4925
- async function remove4(orama, id, language, skipHooks) {
3104
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/methods/remove.js
3105
+ async function remove5(orama, id, language, skipHooks) {
4926
3106
  let result = true;
4927
3107
  const { index, docs } = orama.data;
4928
3108
  const doc = await orama.documentsStore.get(docs, id);
4929
3109
  if (!doc) {
4930
- throw createError("DOCUMENT_DOES_NOT_EXIST", id);
3110
+ return false;
4931
3111
  }
3112
+ const docId = getDocumentIdFromInternalId(orama.internalDocumentIDStore, getInternalDocumentId(orama.internalDocumentIDStore, id));
4932
3113
  const docsCount = await orama.documentsStore.count(docs);
4933
3114
  if (!skipHooks) {
4934
- await runSingleHook(orama.beforeRemove, orama, id);
3115
+ await runSingleHook(orama.beforeRemove, orama, docId);
4935
3116
  }
4936
3117
  const indexableProperties = await orama.index.getSearchableProperties(index);
3118
+ const indexablePropertiesWithTypes = await orama.index.getSearchablePropertiesWithTypes(index);
4937
3119
  const values = await orama.getDocumentProperties(doc, indexableProperties);
4938
3120
  for (const prop of indexableProperties) {
4939
3121
  var _orama_index, _orama_index_beforeRemove, _orama_index1, _orama_index_afterRemove;
4940
3122
  const value = values[prop];
4941
- await ((_orama_index_beforeRemove = (_orama_index = orama.index).beforeRemove) === null || _orama_index_beforeRemove === void 0 ? void 0 : _orama_index_beforeRemove.call(_orama_index, orama.data.index, prop, id, value, language, orama.tokenizer, docsCount));
4942
- if (!await orama.index.remove(orama.index, orama.data.index, prop, id, value, language, orama.tokenizer, docsCount)) {
3123
+ if (typeof value === "undefined") {
3124
+ continue;
3125
+ }
3126
+ const schemaType = indexablePropertiesWithTypes[prop];
3127
+ await ((_orama_index_beforeRemove = (_orama_index = orama.index).beforeRemove) === null || _orama_index_beforeRemove === void 0 ? void 0 : _orama_index_beforeRemove.call(_orama_index, orama.data.index, prop, docId, value, schemaType, language, orama.tokenizer, docsCount));
3128
+ if (!await orama.index.remove(orama.index, orama.data.index, prop, id, value, schemaType, language, orama.tokenizer, docsCount)) {
4943
3129
  result = false;
4944
3130
  }
4945
- await ((_orama_index_afterRemove = (_orama_index1 = orama.index).afterRemove) === null || _orama_index_afterRemove === void 0 ? void 0 : _orama_index_afterRemove.call(_orama_index1, orama.data.index, prop, id, value, language, orama.tokenizer, docsCount));
3131
+ await ((_orama_index_afterRemove = (_orama_index1 = orama.index).afterRemove) === null || _orama_index_afterRemove === void 0 ? void 0 : _orama_index_afterRemove.call(_orama_index1, orama.data.index, prop, docId, value, schemaType, language, orama.tokenizer, docsCount));
3132
+ }
3133
+ const sortableProperties = await orama.sorter.getSortableProperties(orama.data.sorting);
3134
+ const sortableValues = await orama.getDocumentProperties(doc, sortableProperties);
3135
+ for (const prop of sortableProperties) {
3136
+ if (typeof sortableValues[prop] === "undefined") {
3137
+ continue;
3138
+ }
3139
+ await orama.sorter.remove(orama.data.sorting, prop, id);
4946
3140
  }
4947
3141
  if (!skipHooks) {
4948
- await runSingleHook(orama.afterRemove, orama, id);
3142
+ await runSingleHook(orama.afterRemove, orama, docId);
4949
3143
  }
3144
+ await orama.documentsStore.remove(orama.data.docs, id);
4950
3145
  trackRemoval(orama);
4951
3146
  return result;
4952
3147
  }
4953
3148
 
4954
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/facets.js
3149
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/facets.js
4955
3150
  function sortingPredicate(order = "desc", a, b) {
4956
3151
  if (order.toLowerCase() === "asc") {
4957
3152
  return a[1] - b[1];
@@ -4960,7 +3155,7 @@ function sortingPredicate(order = "desc", a, b) {
4960
3155
  }
4961
3156
  }
4962
3157
  async function getFacets(orama, results, facetsConfig) {
4963
- var _a2, _b, _c, _d;
3158
+ var _a2, _b;
4964
3159
  const facets = {};
4965
3160
  const allIDs = results.map(([id]) => id);
4966
3161
  const allDocs = await orama.documentsStore.getMultiple(orama.data.docs, allIDs);
@@ -4989,19 +3184,35 @@ async function getFacets(orama, results, facetsConfig) {
4989
3184
  const doc = allDocs[i];
4990
3185
  for (const facet of facetKeys) {
4991
3186
  const facetValue = facet.includes(".") ? await getNested(doc, facet) : doc[facet];
4992
- if (properties[facet] === "number") {
4993
- for (const range of facetsConfig[facet].ranges) {
4994
- if (facetValue >= range.from && facetValue <= range.to) {
4995
- if (facets[facet].values[`${range.from}-${range.to}`] === void 0) {
4996
- facets[facet].values[`${range.from}-${range.to}`] = 1;
4997
- } else {
4998
- facets[facet].values[`${range.from}-${range.to}`]++;
4999
- }
3187
+ const propertyType = properties[facet];
3188
+ switch (propertyType) {
3189
+ case "number": {
3190
+ const ranges = facetsConfig[facet].ranges;
3191
+ calculateNumberFacet(ranges, facets[facet].values, facetValue);
3192
+ break;
3193
+ }
3194
+ case "number[]": {
3195
+ const alreadyInsertedValues = /* @__PURE__ */ new Set();
3196
+ const ranges = facetsConfig[facet].ranges;
3197
+ for (const v2 of facetValue) {
3198
+ calculateNumberFacet(ranges, facets[facet].values, v2, alreadyInsertedValues);
5000
3199
  }
3200
+ break;
3201
+ }
3202
+ case "boolean":
3203
+ case "string": {
3204
+ calculateBooleanOrStringFacet(facets[facet].values, facetValue, propertyType);
3205
+ break;
3206
+ }
3207
+ case "boolean[]":
3208
+ case "string[]": {
3209
+ const alreadyInsertedValues = /* @__PURE__ */ new Set();
3210
+ const innerType = propertyType === "boolean[]" ? "boolean" : "string";
3211
+ for (const v2 of facetValue) {
3212
+ calculateBooleanOrStringFacet(facets[facet].values, v2, innerType, alreadyInsertedValues);
3213
+ }
3214
+ break;
5001
3215
  }
5002
- } else {
5003
- const value = (_a2 = facetValue === null || facetValue === void 0 ? void 0 : facetValue.toString()) != null ? _a2 : properties[facet] === "boolean" ? "false" : "";
5004
- facets[facet].values[value] = ((_b = facets[facet].values[value]) != null ? _b : 0) + 1;
5005
3216
  }
5006
3217
  }
5007
3218
  }
@@ -5009,13 +3220,42 @@ async function getFacets(orama, results, facetsConfig) {
5009
3220
  facets[facet].count = Object.keys(facets[facet].values).length;
5010
3221
  if (properties[facet] === "string") {
5011
3222
  const stringFacetDefinition = facetsConfig;
5012
- facets[facet].values = Object.fromEntries(Object.entries(facets[facet].values).sort((a, b) => sortingPredicate(stringFacetDefinition.sort, a, b)).slice((_c = stringFacetDefinition.offset) != null ? _c : 0, (_d = stringFacetDefinition.limit) != null ? _d : 10));
3223
+ facets[facet].values = Object.fromEntries(Object.entries(facets[facet].values).sort((a, b) => sortingPredicate(stringFacetDefinition.sort, a, b)).slice((_a2 = stringFacetDefinition.offset) != null ? _a2 : 0, (_b = stringFacetDefinition.limit) != null ? _b : 10));
5013
3224
  }
5014
3225
  }
5015
3226
  return facets;
5016
3227
  }
3228
+ function calculateNumberFacet(ranges, values, facetValue, alreadyInsertedValues) {
3229
+ for (const range of ranges) {
3230
+ const value = `${range.from}-${range.to}`;
3231
+ if (alreadyInsertedValues && alreadyInsertedValues.has(value)) {
3232
+ continue;
3233
+ }
3234
+ if (facetValue >= range.from && facetValue <= range.to) {
3235
+ if (values[value] === void 0) {
3236
+ values[value] = 1;
3237
+ } else {
3238
+ values[value]++;
3239
+ if (alreadyInsertedValues) {
3240
+ alreadyInsertedValues.add(value);
3241
+ }
3242
+ }
3243
+ }
3244
+ }
3245
+ }
3246
+ function calculateBooleanOrStringFacet(values, facetValue, propertyType, alreadyInsertedValues) {
3247
+ var _a2, _b;
3248
+ const value = (_a2 = facetValue === null || facetValue === void 0 ? void 0 : facetValue.toString()) != null ? _a2 : propertyType === "boolean" ? "false" : "";
3249
+ if (alreadyInsertedValues && alreadyInsertedValues.has(value)) {
3250
+ return;
3251
+ }
3252
+ values[value] = ((_b = values[value]) != null ? _b : 0) + 1;
3253
+ if (alreadyInsertedValues) {
3254
+ alreadyInsertedValues.add(value);
3255
+ }
3256
+ }
5017
3257
 
5018
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/filters.js
3258
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/filters.js
5019
3259
  function intersectFilteredIDs(filtered, lookedUp) {
5020
3260
  const map = /* @__PURE__ */ new Map();
5021
3261
  const result = [];
@@ -5034,13 +3274,143 @@ function intersectFilteredIDs(filtered, lookedUp) {
5034
3274
  return result;
5035
3275
  }
5036
3276
 
5037
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/methods/search.js
3277
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/components/groups.js
3278
+ var DEFAULT_REDUCE = {
3279
+ reducer: (_, acc, res, index) => {
3280
+ acc[index] = res;
3281
+ return acc;
3282
+ },
3283
+ getInitialValue: (length) => Array.from({
3284
+ length
3285
+ })
3286
+ };
3287
+ var ALLOWED_TYPES = [
3288
+ "string",
3289
+ "number",
3290
+ "boolean"
3291
+ ];
3292
+ async function getGroups(orama, results, groupBy) {
3293
+ const properties = groupBy.properties;
3294
+ const propertiesLength = properties.length;
3295
+ const schemaProperties = await orama.index.getSearchablePropertiesWithTypes(orama.data.index);
3296
+ for (let i = 0; i < propertiesLength; i++) {
3297
+ const property = properties[i];
3298
+ if (typeof schemaProperties[property] === "undefined") {
3299
+ throw createError("UNKNOWN_GROUP_BY_PROPERTY", property);
3300
+ }
3301
+ if (!ALLOWED_TYPES.includes(schemaProperties[property])) {
3302
+ throw createError("INVALID_GROUP_BY_PROPERTY", property, ALLOWED_TYPES.join(", "), schemaProperties[property]);
3303
+ }
3304
+ }
3305
+ const allIDs = results.map(([id]) => getDocumentIdFromInternalId(orama.internalDocumentIDStore, id));
3306
+ const allDocs = await orama.documentsStore.getMultiple(orama.data.docs, allIDs);
3307
+ const allDocsLength = allDocs.length;
3308
+ const returnedCount = groupBy.maxResult || Number.MAX_SAFE_INTEGER;
3309
+ const listOfValues = [];
3310
+ const g = {};
3311
+ for (let i = 0; i < propertiesLength; i++) {
3312
+ const groupByKey = properties[i];
3313
+ const group = {
3314
+ property: groupByKey,
3315
+ perValue: {}
3316
+ };
3317
+ const values = /* @__PURE__ */ new Set();
3318
+ for (let j = 0; j < allDocsLength; j++) {
3319
+ const doc = allDocs[j];
3320
+ const value = await getNested(doc, groupByKey);
3321
+ if (typeof value === "undefined") {
3322
+ continue;
3323
+ }
3324
+ const keyValue = typeof value !== "boolean" ? value : "" + value;
3325
+ if (typeof group.perValue[keyValue] === "undefined") {
3326
+ group.perValue[keyValue] = {
3327
+ indexes: [],
3328
+ count: 0
3329
+ };
3330
+ }
3331
+ if (group.perValue[keyValue].count >= returnedCount) {
3332
+ continue;
3333
+ }
3334
+ group.perValue[keyValue].indexes.push(j);
3335
+ group.perValue[keyValue].count++;
3336
+ values.add(value);
3337
+ }
3338
+ listOfValues.push(Array.from(values));
3339
+ g[groupByKey] = group;
3340
+ }
3341
+ const combinations = calculateCombination(listOfValues);
3342
+ const combinationsLength = combinations.length;
3343
+ const groups = [];
3344
+ for (let i = 0; i < combinationsLength; i++) {
3345
+ const combination = combinations[i];
3346
+ const combinationLength = combination.length;
3347
+ const group = {
3348
+ values: [],
3349
+ indexes: []
3350
+ };
3351
+ const indexes = [];
3352
+ for (let j = 0; j < combinationLength; j++) {
3353
+ const value = combination[j];
3354
+ const property = properties[j];
3355
+ indexes.push(g[property].perValue[typeof value !== "boolean" ? value : "" + value].indexes);
3356
+ group.values.push(value);
3357
+ }
3358
+ group.indexes = intersect(indexes).sort((a, b) => a - b);
3359
+ if (group.indexes.length === 0) {
3360
+ continue;
3361
+ }
3362
+ groups.push(group);
3363
+ }
3364
+ const groupsLength = groups.length;
3365
+ const res = Array.from({
3366
+ length: groupsLength
3367
+ });
3368
+ for (let i = 0; i < groupsLength; i++) {
3369
+ const group = groups[i];
3370
+ const reduce = groupBy.reduce || DEFAULT_REDUCE;
3371
+ const docs = group.indexes.map((index) => {
3372
+ return {
3373
+ id: allIDs[index],
3374
+ score: results[index][1],
3375
+ document: allDocs[index]
3376
+ };
3377
+ });
3378
+ const func = reduce.reducer.bind(null, group.values);
3379
+ const initialValue = reduce.getInitialValue(group.indexes.length);
3380
+ const aggregationValue = docs.reduce(func, initialValue);
3381
+ res[i] = {
3382
+ values: group.values,
3383
+ result: aggregationValue
3384
+ };
3385
+ }
3386
+ return res;
3387
+ }
3388
+ function calculateCombination(arrs, index = 0) {
3389
+ if (index + 1 === arrs.length)
3390
+ return arrs[index].map((item) => [
3391
+ item
3392
+ ]);
3393
+ const head = arrs[index];
3394
+ const c2 = calculateCombination(arrs, index + 1);
3395
+ const combinations = [];
3396
+ for (const value of head) {
3397
+ for (const combination of c2) {
3398
+ combinations.push([
3399
+ value,
3400
+ ...combination
3401
+ ]);
3402
+ }
3403
+ }
3404
+ return combinations;
3405
+ }
3406
+
3407
+ // ../../node_modules/.pnpm/@orama+orama@1.1.1/node_modules/@orama/orama/dist/methods/search.js
5038
3408
  var defaultBM25Params = {
5039
3409
  k: 1.2,
5040
3410
  b: 0.75,
5041
3411
  d: 0.5
5042
3412
  };
5043
- async function createSearchContext(tokenizer, index, documentsStore, language, params, properties, tokens, docsCount) {
3413
+ async function createSearchContext(tokenizer, index, documentsStore, language, params, properties, tokens, docsCount, timeStart) {
5044
3414
  const indexMap = {};
5045
3415
  const docsIntersection = {};
5046
3416
  for (const prop of properties) {
@@ -5052,7 +3422,7 @@ async function createSearchContext(tokenizer, index, documentsStore, language, p
5052
3422
  docsIntersection[prop] = [];
5053
3423
  }
5054
3424
  return {
5055
- timeStart: await getNanosecondsTime(),
3425
+ timeStart,
5056
3426
  tokenizer,
5057
3427
  index,
5058
3428
  documentsStore,
@@ -5066,9 +3436,10 @@ async function createSearchContext(tokenizer, index, documentsStore, language, p
5066
3436
  }
5067
3437
  async function search2(orama, params, language) {
5068
3438
  var _a2, _b, _c;
3439
+ const timeStart = await getNanosecondsTime();
5069
3440
  params.relevance = Object.assign((_a2 = params.relevance) != null ? _a2 : {}, defaultBM25Params);
5070
3441
  const shouldCalculateFacets = params.facets && Object.keys(params.facets).length > 0;
5071
- const { limit = 10, offset = 0, term, properties, threshold = 1 } = params;
3442
+ const { limit = 10, offset = 0, term, properties, threshold = 1, distinctOn } = params;
5072
3443
  const isPreflight = params.preflight === true;
5073
3444
  const { index, docs } = orama.data;
5074
3445
  const tokens = await orama.tokenizer.tokenize(term != null ? term : "", language);
@@ -5076,7 +3447,7 @@ async function search2(orama, params, language) {
5076
3447
  if (!propertiesToSearch) {
5077
3448
  const propertiesToSearchWithTypes = await orama.index.getSearchablePropertiesWithTypes(index);
5078
3449
  propertiesToSearch = await orama.index.getSearchableProperties(index);
5079
- propertiesToSearch = propertiesToSearch.filter((prop) => propertiesToSearchWithTypes[prop] === "string");
3450
+ propertiesToSearch = propertiesToSearch.filter((prop) => propertiesToSearchWithTypes[prop].startsWith("string"));
5080
3451
  orama.caches["propertiesToSearch"] = propertiesToSearch;
5081
3452
  }
5082
3453
  if (properties && properties !== "*") {
@@ -5087,29 +3458,27 @@ async function search2(orama, params, language) {
5087
3458
  }
5088
3459
  propertiesToSearch = propertiesToSearch.filter((prop) => properties.includes(prop));
5089
3460
  }
5090
- const context = await createSearchContext(orama.tokenizer, orama.index, orama.documentsStore, language, params, propertiesToSearch, tokens, await orama.documentsStore.count(docs));
5091
- const results = Array.from({
5092
- length: limit
5093
- });
3461
+ const context = await createSearchContext(orama.tokenizer, orama.index, orama.documentsStore, language, params, propertiesToSearch, tokens, await orama.documentsStore.count(docs), timeStart);
5094
3462
  const hasFilters = Object.keys((_b = params.where) != null ? _b : {}).length > 0;
5095
3463
  let whereFiltersIDs = [];
5096
3464
  if (hasFilters) {
5097
3465
  whereFiltersIDs = await orama.index.searchByWhereClause(context, index, params.where);
5098
3466
  }
5099
- if (tokens.length) {
3467
+ const tokensLength = tokens.length;
3468
+ if (tokensLength) {
5100
3469
  const indexesLength = propertiesToSearch.length;
5101
3470
  for (let i = 0; i < indexesLength; i++) {
5102
3471
  var _params_boost;
5103
3472
  const prop = propertiesToSearch[i];
5104
- const tokensLength = tokens.length;
5105
- for (let j = 0; j < tokensLength; j++) {
3473
+ const tokensLength2 = tokens.length;
3474
+ for (let j = 0; j < tokensLength2; j++) {
5106
3475
  const term2 = tokens[j];
5107
3476
  const scoreList = await orama.index.search(context, index, prop, term2);
5108
3477
  context.indexMap[prop][term2].push(...scoreList);
5109
3478
  }
5110
3479
  const docIds = context.indexMap[prop];
5111
3480
  const vals = Object.values(docIds);
5112
- context.docsIntersection[prop] = prioritizeTokenScores(vals, (_c = params === null || params === void 0 ? void 0 : (_params_boost = params.boost) === null || _params_boost === void 0 ? void 0 : _params_boost[prop]) != null ? _c : 1, threshold);
3481
+ context.docsIntersection[prop] = prioritizeTokenScores(vals, (_c = params === null || params === void 0 ? void 0 : (_params_boost = params.boost) === null || _params_boost === void 0 ? void 0 : _params_boost[prop]) != null ? _c : 1, threshold, tokensLength2);
5113
3482
  const uniqueDocs = context.docsIntersection[prop];
5114
3483
  const uniqueDocsLength = uniqueDocs.length;
5115
3484
  for (let i2 = 0; i2 < uniqueDocsLength; i2++) {
@@ -5122,49 +3491,136 @@ async function search2(orama, params, language) {
5122
3491
  }
5123
3492
  }
5124
3493
  }
3494
+ } else if (tokens.length === 0 && term) {
3495
+ context.uniqueDocsIDs = {};
5125
3496
  } else {
5126
3497
  context.uniqueDocsIDs = Object.fromEntries(Object.keys(await orama.documentsStore.getAll(orama.data.docs)).map((k) => [
5127
3498
  k,
5128
3499
  0
5129
3500
  ]));
5130
3501
  }
5131
- let uniqueDocsArray = Object.entries(context.uniqueDocsIDs).sort(sortTokenScorePredicate);
3502
+ let uniqueDocsArray = Object.entries(context.uniqueDocsIDs).map(([id, score]) => [
3503
+ +id,
3504
+ score
3505
+ ]);
5132
3506
  if (hasFilters) {
5133
3507
  uniqueDocsArray = intersectFilteredIDs(whereFiltersIDs, uniqueDocsArray);
5134
3508
  }
5135
- const resultIDs = /* @__PURE__ */ new Set();
5136
- const facets = shouldCalculateFacets ? await getFacets(orama, uniqueDocsArray, params.facets) : {};
5137
- if (!isPreflight) {
5138
- for (let i = offset; i < limit + offset; i++) {
5139
- const idAndScore = uniqueDocsArray[i];
5140
- if (typeof idAndScore === "undefined") {
5141
- break;
5142
- }
5143
- const [id, score] = idAndScore;
5144
- if (!resultIDs.has(id)) {
5145
- const fullDoc = await orama.documentsStore.get(docs, id);
5146
- results[i] = {
5147
- id,
5148
- score,
5149
- document: fullDoc
5150
- };
5151
- resultIDs.add(id);
5152
- }
3509
+ if (params.sortBy) {
3510
+ if (typeof params.sortBy === "function") {
3511
+ const ids = uniqueDocsArray.map(([id]) => id);
3512
+ const docs2 = await orama.documentsStore.getMultiple(orama.data.docs, ids);
3513
+ const docsWithIdAndScore = docs2.map((d, i) => [
3514
+ uniqueDocsArray[i][0],
3515
+ uniqueDocsArray[i][1],
3516
+ d
3517
+ ]);
3518
+ docsWithIdAndScore.sort(params.sortBy);
3519
+ uniqueDocsArray = docsWithIdAndScore.map(([id, score]) => [
3520
+ id,
3521
+ score
3522
+ ]);
3523
+ } else {
3524
+ uniqueDocsArray = await orama.sorter.sortBy(orama.data.sorting, uniqueDocsArray, params.sortBy).then((results2) => results2.map(([id, score]) => [
3525
+ getInternalDocumentId(orama.internalDocumentIDStore, id),
3526
+ score
3527
+ ]));
5153
3528
  }
3529
+ } else {
3530
+ uniqueDocsArray = uniqueDocsArray.sort(sortTokenScorePredicate);
3531
+ }
3532
+ let results;
3533
+ if (!isPreflight && distinctOn) {
3534
+ results = await fetchDocumentsWithDistinct(orama, uniqueDocsArray, offset, limit, distinctOn);
3535
+ } else if (!isPreflight) {
3536
+ results = await fetchDocuments(orama, uniqueDocsArray, offset, limit);
5154
3537
  }
5155
3538
  const searchResult = {
5156
- elapsed: await orama.formatElapsedTime(await getNanosecondsTime() - context.timeStart),
3539
+ elapsed: {
3540
+ formatted: "",
3541
+ raw: 0
3542
+ },
5157
3543
  hits: [],
5158
3544
  count: uniqueDocsArray.length
5159
3545
  };
5160
- if (!isPreflight) {
3546
+ if (typeof results !== "undefined") {
5161
3547
  searchResult.hits = results.filter(Boolean);
5162
3548
  }
5163
3549
  if (shouldCalculateFacets) {
3550
+ const facets = await getFacets(orama, uniqueDocsArray, params.facets);
5164
3551
  searchResult.facets = facets;
5165
3552
  }
3553
+ if (params.groupBy) {
3554
+ searchResult.groups = await getGroups(orama, uniqueDocsArray, params.groupBy);
3555
+ }
3556
+ if (orama.afterSearch) {
3557
+ await runAfterSearch(orama.afterSearch, orama, params, language, searchResult);
3558
+ }
3559
+ searchResult.elapsed = await orama.formatElapsedTime(await getNanosecondsTime() - context.timeStart);
5166
3560
  return searchResult;
5167
3561
  }
3562
+ async function fetchDocumentsWithDistinct(orama, uniqueDocsArray, offset, limit, distinctOn) {
3563
+ const docs = orama.data.docs;
3564
+ const values = /* @__PURE__ */ new Map();
3565
+ const results = [];
3566
+ const resultIDs = /* @__PURE__ */ new Set();
3567
+ const uniqueDocsArrayLength = uniqueDocsArray.length;
3568
+ let count2 = 0;
3569
+ for (let i = 0; i < uniqueDocsArrayLength; i++) {
3570
+ const idAndScore = uniqueDocsArray[i];
3571
+ if (typeof idAndScore === "undefined") {
3572
+ continue;
3573
+ }
3574
+ const [id, score] = idAndScore;
3575
+ if (resultIDs.has(id)) {
3576
+ continue;
3577
+ }
3578
+ const doc = await orama.documentsStore.get(docs, id);
3579
+ const value = await getNested(doc, distinctOn);
3580
+ if (typeof value === "undefined" || values.has(value)) {
3581
+ continue;
3582
+ }
3583
+ values.set(value, true);
3584
+ count2++;
3585
+ if (count2 <= offset) {
3586
+ continue;
3587
+ }
3588
+ results.push({
3589
+ id: getDocumentIdFromInternalId(orama.internalDocumentIDStore, id),
3590
+ score,
3591
+ document: doc
3592
+ });
3593
+ resultIDs.add(id);
3594
+ if (count2 >= offset + limit) {
3595
+ break;
3596
+ }
3597
+ }
3598
+ return results;
3599
+ }
3600
+ async function fetchDocuments(orama, uniqueDocsArray, offset, limit) {
3601
+ const docs = orama.data.docs;
3602
+ const results = Array.from({
3603
+ length: limit
3604
+ });
3605
+ const resultIDs = /* @__PURE__ */ new Set();
3606
+ for (let i = offset; i < limit + offset; i++) {
3607
+ const idAndScore = uniqueDocsArray[i];
3608
+ if (typeof idAndScore === "undefined") {
3609
+ break;
3610
+ }
3611
+ const [id, score] = idAndScore;
3612
+ if (!resultIDs.has(id)) {
3613
+ const fullDoc = await orama.documentsStore.get(docs, id);
3614
+ results[i] = {
3615
+ id: getDocumentIdFromInternalId(orama.internalDocumentIDStore, id),
3616
+ score,
3617
+ document: fullDoc
3618
+ };
3619
+ resultIDs.add(id);
3620
+ }
3621
+ }
3622
+ return results;
3623
+ }
5168
3624
 
5169
3625
  // src/indexer.ts
5170
3626
  var import_debug = __toESM(require_src());
@@ -5189,7 +3645,7 @@ var SearchMemoryIndexer = class {
5189
3645
  if (this.database) {
5190
3646
  const name = pkg.name;
5191
3647
  debug("adding item %s to the indexer", name);
5192
- insert4(this.database, {
3648
+ insert5(this.database, {
5193
3649
  id: name,
5194
3650
  name,
5195
3651
  description: pkg.description,
@@ -5202,7 +3658,7 @@ var SearchMemoryIndexer = class {
5202
3658
  async remove(name) {
5203
3659
  if (this.database) {
5204
3660
  debug("removing item %s to the indexer", name);
5205
- await remove4(this.database, name);
3661
+ await remove5(this.database, name);
5206
3662
  }
5207
3663
  }
5208
3664
  reindex() {
@@ -5225,7 +3681,7 @@ var SearchMemoryIndexer = class {
5225
3681
  });
5226
3682
  }
5227
3683
  async init() {
5228
- this.database = await create5({
3684
+ this.database = await create6({
5229
3685
  schema: {
5230
3686
  id: "string",
5231
3687
  name: "string",