@verdaccio/search 6.0.0-6-next.2 → 7.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.2.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.2.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.2.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,19 @@ 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".`,
1016
+ INVALID_VECTOR_SIZE: `Vector size must be a number greater than 0. Got "%s" instead.`,
1017
+ INVALID_VECTOR_VALUE: `Vector value must be a number greater than 0. Got "%s" instead.`,
1018
+ INVALID_INPUT_VECTOR: `Property "%s" was declared as a %s-dimentional vector, but got a %s-dimentional vector instead.
1019
+ Input vectors must be of the size declared in the schema, as calculating similarity between vectors of different sizes can lead to unexpected results.`
1009
1020
  };
1010
1021
  function createError(code, ...args) {
1011
1022
  var _a2;
@@ -1017,7 +1028,7 @@ function createError(code, ...args) {
1017
1028
  return error;
1018
1029
  }
1019
1030
 
1020
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/defaults.js
1031
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/defaults.js
1021
1032
  async function formatElapsedTime(n) {
1022
1033
  return {
1023
1034
  raw: Number(n),
@@ -1035,37 +1046,147 @@ async function getDocumentIndexId(doc) {
1035
1046
  }
1036
1047
  async function validateSchema(doc, schema) {
1037
1048
  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;
1049
+ const value = doc[prop];
1050
+ const typeOfValue = typeof value;
1051
+ if (typeOfValue === "undefined") {
1052
+ continue;
1053
+ }
1054
+ const typeOfType = typeof type;
1055
+ if (isVectorType(type)) {
1056
+ const vectorSize = getVectorSize(type);
1057
+ if (!Array.isArray(value) || value.length !== vectorSize) {
1058
+ throw createError("INVALID_INPUT_VECTOR", prop, vectorSize, value.length);
1041
1059
  }
1042
- if (!validateSchema(doc[prop], type)) {
1043
- return false;
1060
+ continue;
1061
+ }
1062
+ if (typeOfType === "string" && isArrayType(type)) {
1063
+ if (!Array.isArray(value)) {
1064
+ return prop;
1065
+ }
1066
+ const expectedType = getInnerType(type);
1067
+ const valueLength = value.length;
1068
+ for (let i = 0; i < valueLength; i++) {
1069
+ if (typeof value[i] !== expectedType) {
1070
+ return prop + "." + i;
1071
+ }
1044
1072
  }
1073
+ continue;
1045
1074
  }
1046
- if (typeof doc[prop] !== type) {
1047
- return false;
1075
+ if (typeOfType === "object") {
1076
+ if (!value || typeOfValue !== "object") {
1077
+ return prop;
1078
+ }
1079
+ const subProp = await validateSchema(value, type);
1080
+ if (subProp) {
1081
+ return prop + "." + subProp;
1082
+ }
1083
+ continue;
1084
+ }
1085
+ if (typeOfValue !== type) {
1086
+ return prop;
1048
1087
  }
1049
1088
  }
1050
- return true;
1089
+ return void 0;
1090
+ }
1091
+ var IS_ARRAY_TYPE = {
1092
+ string: false,
1093
+ number: false,
1094
+ boolean: false,
1095
+ "string[]": true,
1096
+ "number[]": true,
1097
+ "boolean[]": true
1098
+ };
1099
+ var INNER_TYPE = {
1100
+ "string[]": "string",
1101
+ "number[]": "number",
1102
+ "boolean[]": "boolean"
1103
+ };
1104
+ function isVectorType(type) {
1105
+ return /^vector\[\d+\]$/.test(type);
1106
+ }
1107
+ function isArrayType(type) {
1108
+ return IS_ARRAY_TYPE[type];
1109
+ }
1110
+ function getInnerType(type) {
1111
+ return INNER_TYPE[type];
1112
+ }
1113
+ function getVectorSize(type) {
1114
+ const size = Number(type.slice(7, -1));
1115
+ switch (true) {
1116
+ case isNaN(size):
1117
+ throw createError("INVALID_VECTOR_VALUE", type);
1118
+ case size <= 0:
1119
+ throw createError("INVALID_VECTOR_SIZE", type);
1120
+ default:
1121
+ return size;
1122
+ }
1123
+ }
1124
+
1125
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/internal-document-id-store.js
1126
+ function createInternalDocumentIDStore() {
1127
+ return {
1128
+ idToInternalId: /* @__PURE__ */ new Map(),
1129
+ internalIdToId: [],
1130
+ save,
1131
+ load
1132
+ };
1133
+ }
1134
+ function save(store2) {
1135
+ return {
1136
+ internalIdToId: store2.internalIdToId
1137
+ };
1138
+ }
1139
+ function load(orama, raw) {
1140
+ const { internalIdToId } = raw;
1141
+ orama.internalDocumentIDStore.idToInternalId.clear();
1142
+ orama.internalDocumentIDStore.internalIdToId = [];
1143
+ for (let i = 0; i < internalIdToId.length; i++) {
1144
+ orama.internalDocumentIDStore.idToInternalId.set(internalIdToId[i], i + 1);
1145
+ orama.internalDocumentIDStore.internalIdToId.push(internalIdToId[i]);
1146
+ }
1147
+ }
1148
+ function getInternalDocumentId(store2, id) {
1149
+ if (typeof id === "string") {
1150
+ const internalId = store2.idToInternalId.get(id);
1151
+ if (internalId) {
1152
+ return internalId;
1153
+ }
1154
+ const currentId = store2.idToInternalId.size + 1;
1155
+ store2.idToInternalId.set(id, currentId);
1156
+ store2.internalIdToId.push(id);
1157
+ return currentId;
1158
+ }
1159
+ if (id > store2.internalIdToId.length) {
1160
+ return getInternalDocumentId(store2, id.toString());
1161
+ }
1162
+ return id;
1163
+ }
1164
+ function getDocumentIdFromInternalId(store2, internalId) {
1165
+ if (store2.internalIdToId.length < internalId) {
1166
+ throw new Error(`Invalid internalId ${internalId}`);
1167
+ }
1168
+ return store2.internalIdToId[internalId - 1];
1051
1169
  }
1052
1170
 
1053
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/documents-store.js
1054
- async function create() {
1171
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/documents-store.js
1172
+ async function create(_, sharedInternalDocumentStore) {
1055
1173
  return {
1174
+ sharedInternalDocumentStore,
1056
1175
  docs: {},
1057
1176
  count: 0
1058
1177
  };
1059
1178
  }
1060
1179
  async function get(store2, id) {
1061
- return store2.docs[id];
1180
+ const internalId = getInternalDocumentId(store2.sharedInternalDocumentStore, id);
1181
+ return store2.docs[internalId];
1062
1182
  }
1063
1183
  async function getMultiple(store2, ids) {
1064
1184
  const found = Array.from({
1065
1185
  length: ids.length
1066
1186
  });
1067
1187
  for (let i = 0; i < ids.length; i++) {
1068
- found[i] = store2.docs[ids[i]];
1188
+ const internalId = getInternalDocumentId(store2.sharedInternalDocumentStore, ids[i]);
1189
+ found[i] = store2.docs[internalId];
1069
1190
  }
1070
1191
  return found;
1071
1192
  }
@@ -1073,35 +1194,38 @@ async function getAll(store2) {
1073
1194
  return store2.docs;
1074
1195
  }
1075
1196
  async function store(store2, id, doc) {
1076
- if (typeof store2.docs[id] !== "undefined") {
1197
+ const internalId = getInternalDocumentId(store2.sharedInternalDocumentStore, id);
1198
+ if (typeof store2.docs[internalId] !== "undefined") {
1077
1199
  return false;
1078
1200
  }
1079
- store2.docs[id] = doc;
1201
+ store2.docs[internalId] = doc;
1080
1202
  store2.count++;
1081
1203
  return true;
1082
1204
  }
1083
1205
  async function remove(store2, id) {
1084
- if (typeof store2.docs[id] === "undefined") {
1206
+ const internalId = getInternalDocumentId(store2.sharedInternalDocumentStore, id);
1207
+ if (typeof store2.docs[internalId] === "undefined") {
1085
1208
  return false;
1086
1209
  }
1087
- store2.docs[id] = void 0;
1210
+ delete store2.docs[internalId];
1088
1211
  store2.count--;
1089
1212
  return true;
1090
1213
  }
1091
1214
  async function count(store2) {
1092
1215
  return store2.count;
1093
1216
  }
1094
- async function load(raw) {
1217
+ async function load2(sharedInternalDocumentStore, raw) {
1095
1218
  const rawDocument = raw;
1096
1219
  return {
1097
1220
  docs: rawDocument.docs,
1098
- count: rawDocument.count
1221
+ count: rawDocument.count,
1222
+ sharedInternalDocumentStore
1099
1223
  };
1100
1224
  }
1101
- async function save(docs) {
1225
+ async function save2(store2) {
1102
1226
  return {
1103
- docs: docs.docs,
1104
- count: docs.count
1227
+ docs: store2.docs,
1228
+ count: store2.count
1105
1229
  };
1106
1230
  }
1107
1231
  async function createDocumentsStore() {
@@ -1113,16 +1237,17 @@ async function createDocumentsStore() {
1113
1237
  store,
1114
1238
  remove,
1115
1239
  count,
1116
- load,
1117
- save
1240
+ load: load2,
1241
+ save: save2
1118
1242
  };
1119
1243
  }
1120
1244
 
1121
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/hooks.js
1245
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/hooks.js
1122
1246
  var OBJECT_COMPONENTS = [
1123
1247
  "tokenizer",
1124
1248
  "index",
1125
- "documentsStore"
1249
+ "documentsStore",
1250
+ "sorter"
1126
1251
  ];
1127
1252
  var FUNCTION_COMPONENTS = [
1128
1253
  "validateSchema",
@@ -1137,6 +1262,7 @@ var SINGLE_OR_ARRAY_COMPONENTS = [
1137
1262
  "afterRemove",
1138
1263
  "beforeUpdate",
1139
1264
  "afterUpdate",
1265
+ "afterSearch",
1140
1266
  "beforeMultipleInsert",
1141
1267
  "afterMultipleInsert",
1142
1268
  "beforeMultipleRemove",
@@ -1145,34 +1271,26 @@ var SINGLE_OR_ARRAY_COMPONENTS = [
1145
1271
  "afterMultipleUpdate"
1146
1272
  ];
1147
1273
  async function runSingleHook(hooks, orama, id, doc) {
1148
- for (let i = 0; i < hooks.length; i++) {
1274
+ const hooksLength = hooks.length;
1275
+ for (let i = 0; i < hooksLength; i++) {
1149
1276
  await hooks[i](orama, id, doc);
1150
1277
  }
1151
1278
  }
1279
+ async function runAfterSearch(hooks, db, params, language, results) {
1280
+ const hooksLength = hooks.length;
1281
+ for (let i = 0; i < hooksLength; i++) {
1282
+ await hooks[i](db, params, language, results);
1283
+ }
1284
+ }
1152
1285
 
1153
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/trees/avl.js
1286
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/trees/avl.js
1154
1287
  var BALANCE_STATE = {
1155
- UNBALANCED_RIGHT: 1,
1156
- SLIGHTLY_UNBALANCED_RIGHT: 2,
1157
- BALANCED: 3,
1158
- SLIGHTLY_UNBALANCED_LEFT: 4,
1159
- UNBALANCED_LEFT: 5
1288
+ UNBALANCED_RIGHT: -2,
1289
+ SLIGHTLY_UNBALANCED_RIGHT: -1,
1290
+ BALANCED: 0,
1291
+ SLIGHTLY_UNBALANCED_LEFT: 1,
1292
+ UNBALANCED_LEFT: 2
1160
1293
  };
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
1294
  function getHeight(node) {
1177
1295
  return node ? node.height : -1;
1178
1296
  }
@@ -1192,9 +1310,6 @@ function rotateRight(node) {
1192
1310
  left.height = Math.max(getHeight(left.left), getHeight(left.right)) + 1;
1193
1311
  return left;
1194
1312
  }
1195
- function findMin(node) {
1196
- return node.left ? findMin(node.left) : node;
1197
- }
1198
1313
  function rangeSearch(node, min, max) {
1199
1314
  if (!node) {
1200
1315
  return [];
@@ -1260,16 +1375,16 @@ function lessThan(node, key, inclusive = false) {
1260
1375
  return result;
1261
1376
  }
1262
1377
  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;
1378
+ while (node !== null) {
1379
+ if (key < node.key) {
1380
+ node = node.left;
1381
+ } else if (key > node.key) {
1382
+ node = node.right;
1383
+ } else {
1384
+ return node;
1385
+ }
1271
1386
  }
1272
- return node.right ? getNodeByKey(node.right, key) : null;
1387
+ return null;
1273
1388
  }
1274
1389
  function create2(key, value) {
1275
1390
  return {
@@ -1280,93 +1395,124 @@ function create2(key, value) {
1280
1395
  height: 0
1281
1396
  };
1282
1397
  }
1283
- function insert(node, key, value) {
1284
- if (!node) {
1285
- return create2(key, value);
1398
+ function insert(root, key, value) {
1399
+ let parent = null;
1400
+ let current = root;
1401
+ while (current !== null) {
1402
+ parent = current;
1403
+ if (key < current.key) {
1404
+ current = current.left;
1405
+ } else if (key > current.key) {
1406
+ current = current.right;
1407
+ } else {
1408
+ current.value = current.value.concat(value);
1409
+ return root;
1410
+ }
1286
1411
  }
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);
1412
+ const newNode = create2(key, value);
1413
+ if (!parent) {
1414
+ root = newNode;
1415
+ } else if (key < parent.key) {
1416
+ parent.left = newNode;
1291
1417
  } else {
1292
- node.value = node.value.concat(value);
1293
- return node;
1418
+ parent.right = newNode;
1294
1419
  }
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);
1420
+ current = newNode;
1421
+ while (parent) {
1422
+ const balanceFactor = getHeight(parent.left) - getHeight(parent.right);
1423
+ if (balanceFactor === BALANCE_STATE.UNBALANCED_LEFT) {
1424
+ if (key > parent.left.key) {
1425
+ parent.left = rotateLeft(parent.left);
1426
+ }
1427
+ parent = rotateRight(parent);
1302
1428
  }
1429
+ if (balanceFactor === BALANCE_STATE.UNBALANCED_RIGHT) {
1430
+ if (key < parent.right.key) {
1431
+ parent.right = rotateRight(parent.right);
1432
+ }
1433
+ parent = rotateLeft(parent);
1434
+ }
1435
+ if (parent === root) {
1436
+ break;
1437
+ }
1438
+ current = parent;
1439
+ parent = getNodeParent(root, current.key);
1303
1440
  }
1304
- if (balanceFactor === BALANCE_STATE.UNBALANCED_RIGHT) {
1305
- if (key > node.right.key) {
1306
- node = rotateLeft(node);
1441
+ return root;
1442
+ }
1443
+ function getNodeParent(root, key) {
1444
+ let current = root;
1445
+ let parent = null;
1446
+ while (current !== null) {
1447
+ if (key < current.key) {
1448
+ parent = current;
1449
+ current = current.left;
1450
+ } else if (key > current.key) {
1451
+ parent = current;
1452
+ current = current.right;
1307
1453
  } else {
1308
- node.right = rotateRight(node.right);
1309
- node = rotateLeft(node);
1454
+ break;
1310
1455
  }
1311
1456
  }
1312
- return node;
1457
+ return parent;
1313
1458
  }
1314
- function find(node, key) {
1459
+ function find(root, key) {
1460
+ const node = getNodeByKey(root, key);
1315
1461
  if (!node) {
1316
1462
  return null;
1317
1463
  }
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;
1464
+ return node.value;
1325
1465
  }
1326
- function remove2(node, key) {
1466
+ function remove2(root, key) {
1467
+ let node = root;
1468
+ let parentNode = null;
1469
+ while (node && node.key !== key) {
1470
+ parentNode = node;
1471
+ if (key < node.key) {
1472
+ node = node.left;
1473
+ } else {
1474
+ node = node.right;
1475
+ }
1476
+ }
1327
1477
  if (!node) {
1328
1478
  return null;
1329
1479
  }
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);
1480
+ if (!node.left && !node.right) {
1481
+ if (!parentNode) {
1482
+ root = null;
1483
+ } else {
1484
+ if (parentNode.left === node) {
1485
+ parentNode.left = null;
1486
+ } else {
1487
+ parentNode.right = null;
1488
+ }
1354
1489
  }
1355
- if (getBalanceFactor(leftNode) === BALANCE_STATE.SLIGHTLY_UNBALANCED_RIGHT) {
1356
- node.left = rotateLeft(leftNode);
1357
- return rotateRight(node);
1490
+ } else if (node.left && node.right) {
1491
+ let minValueNode = node.right;
1492
+ let minValueParent = node;
1493
+ while (minValueNode.left) {
1494
+ minValueParent = minValueNode;
1495
+ minValueNode = minValueNode.left;
1358
1496
  }
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);
1497
+ node.key = minValueNode.key;
1498
+ if (minValueParent === node) {
1499
+ minValueParent.right = minValueNode.right;
1500
+ } else {
1501
+ minValueParent.left = minValueNode.right;
1363
1502
  }
1364
- if (getBalanceFactor(rightNode) === BALANCE_STATE.SLIGHTLY_UNBALANCED_LEFT) {
1365
- node.right = rotateRight(rightNode);
1366
- return rotateLeft(node);
1503
+ } else {
1504
+ const childNode = node.left ? node.left : node.right;
1505
+ if (!parentNode) {
1506
+ root = childNode;
1507
+ } else {
1508
+ if (parentNode.left === node) {
1509
+ parentNode.left = childNode;
1510
+ } else {
1511
+ parentNode.right = childNode;
1512
+ }
1367
1513
  }
1368
1514
  }
1369
- return node;
1515
+ return root;
1370
1516
  }
1371
1517
  function removeDocument(root, id, key) {
1372
1518
  const node = getNodeByKey(root, key);
@@ -1377,7 +1523,7 @@ function removeDocument(root, id, key) {
1377
1523
  node.value.splice(node.value.indexOf(id), 1);
1378
1524
  }
1379
1525
 
1380
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/levenshtein.js
1526
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/levenshtein.js
1381
1527
  function _boundedLevenshtein(a, b, tolerance) {
1382
1528
  if (a === b) {
1383
1529
  return 0;
@@ -1466,19 +1612,27 @@ function syncBoundedLevenshtein(a, b, tolerance) {
1466
1612
  };
1467
1613
  }
1468
1614
 
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
- }
1615
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/trees/radix.js
1616
+ var Node = class {
1617
+ constructor(key, subWord, end) {
1618
+ this.key = key;
1619
+ this.subWord = subWord;
1620
+ this.end = end;
1621
+ }
1622
+ children = {};
1623
+ docs = [];
1624
+ word = "";
1625
+ toJSON() {
1626
+ return {
1627
+ word: this.word,
1628
+ subWord: this.subWord,
1629
+ children: this.children,
1630
+ docs: this.docs,
1631
+ end: this.end
1632
+ };
1633
+ }
1634
+ };
1480
1635
  function updateParent(node, parent) {
1481
- node.parent = parent.id;
1482
1636
  node.word = parent.word + node.subWord;
1483
1637
  }
1484
1638
  function addDocument(node, docID) {
@@ -1534,20 +1688,7 @@ function getCommonPrefix(a, b) {
1534
1688
  return commonPrefix;
1535
1689
  }
1536
1690
  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;
1691
+ return new Node(key, subWord, end);
1551
1692
  }
1552
1693
  function insert2(root, word, docId) {
1553
1694
  for (let i = 0; i < word.length; i++) {
@@ -1559,12 +1700,12 @@ function insert2(root, word, docId) {
1559
1700
  const edgeLabelLength = edgeLabel.length;
1560
1701
  const commonPrefix = getCommonPrefix(edgeLabel, wordAtIndex);
1561
1702
  const commonPrefixLength = commonPrefix.length;
1562
- const edgeLabelAtCommonPrefix = edgeLabel[commonPrefixLength];
1563
1703
  if (edgeLabel === wordAtIndex) {
1564
1704
  addDocument(rootChildCurrentChar, docId);
1565
1705
  rootChildCurrentChar.end = true;
1566
1706
  return;
1567
1707
  }
1708
+ const edgeLabelAtCommonPrefix = edgeLabel[commonPrefixLength];
1568
1709
  if (commonPrefixLength < edgeLabelLength && commonPrefixLength === wordAtIndex.length) {
1569
1710
  const newNode = create3(true, wordAtIndex, currentCharacter);
1570
1711
  newNode.children[edgeLabelAtCommonPrefix] = rootChildCurrentChar;
@@ -1649,12 +1790,13 @@ function removeDocumentByWord(root, term, docID, exact = true) {
1649
1790
  return true;
1650
1791
  }
1651
1792
 
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) {
1793
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/algorithms.js
1794
+ function prioritizeTokenScores(arrays, boost, threshold = 1, keywordsCount) {
1654
1795
  if (boost === 0) {
1655
1796
  throw createError("INVALID_BOOST_VALUE");
1656
1797
  }
1657
- const tokenMap = {};
1798
+ const tokenScoresMap = /* @__PURE__ */ new Map();
1799
+ const tokenKeywordsCountMap = /* @__PURE__ */ new Map();
1658
1800
  const mapsLength = arrays.length;
1659
1801
  for (let i = 0; i < mapsLength; i++) {
1660
1802
  const arr = arrays[i];
@@ -1662,22 +1804,48 @@ function prioritizeTokenScores(arrays, boost, threshold = 1) {
1662
1804
  for (let j = 0; j < entriesLength; j++) {
1663
1805
  const [token, score] = arr[j];
1664
1806
  const boostScore = score * boost;
1665
- if (token in tokenMap) {
1666
- tokenMap[token] *= 1.5 + boostScore;
1807
+ const oldScore = tokenScoresMap.get(token);
1808
+ if (oldScore !== void 0) {
1809
+ tokenScoresMap.set(token, oldScore * 1.5 + boostScore);
1810
+ tokenKeywordsCountMap.set(token, tokenKeywordsCountMap.get(token) + 1);
1667
1811
  } else {
1668
- tokenMap[token] = boostScore;
1812
+ tokenScoresMap.set(token, boostScore);
1813
+ tokenKeywordsCountMap.set(token, 1);
1669
1814
  }
1670
1815
  }
1671
1816
  }
1672
- const results = Object.entries(tokenMap).sort((a, b) => b[1] - a[1]);
1817
+ const tokenScores = [];
1818
+ for (const tokenScoreEntry of tokenScoresMap.entries()) {
1819
+ tokenScores.push(tokenScoreEntry);
1820
+ }
1821
+ const results = tokenScores.sort((a, b) => b[1] - a[1]);
1673
1822
  if (threshold === 1) {
1674
1823
  return results;
1675
1824
  }
1825
+ const allResults = results.length;
1826
+ const tokenKeywordsCount = [];
1827
+ for (const tokenKeywordsCountEntry of tokenKeywordsCountMap.entries()) {
1828
+ tokenKeywordsCount.push(tokenKeywordsCountEntry);
1829
+ }
1830
+ const keywordsPerToken = tokenKeywordsCount.sort((a, b) => b[1] - a[1]);
1831
+ let lastTokenWithAllKeywords = void 0;
1832
+ for (let i = 0; i < allResults; i++) {
1833
+ if (keywordsPerToken[i][1] === keywordsCount) {
1834
+ lastTokenWithAllKeywords = i;
1835
+ } else {
1836
+ break;
1837
+ }
1838
+ }
1839
+ if (typeof lastTokenWithAllKeywords === "undefined") {
1840
+ if (threshold === 0) {
1841
+ return [];
1842
+ }
1843
+ lastTokenWithAllKeywords = 0;
1844
+ }
1676
1845
  if (threshold === 0) {
1677
- const shortestArrayLength = Math.min(...arrays.map((arr) => arr.length));
1678
- return results.slice(0, shortestArrayLength);
1846
+ return results.slice(0, lastTokenWithAllKeywords + 1);
1679
1847
  }
1680
- const thresholdLength = Math.ceil(threshold * 100 * results.length / 100);
1848
+ const thresholdLength = lastTokenWithAllKeywords + Math.ceil(threshold * 100 * (results.length - lastTokenWithAllKeywords) / 100);
1681
1849
  return results.slice(0, results.length + thresholdLength);
1682
1850
  }
1683
1851
  function BM25(tf, matchingCount, docsCount, fieldLength, averageFieldLength, BM25Params) {
@@ -1686,12 +1854,22 @@ function BM25(tf, matchingCount, docsCount, fieldLength, averageFieldLength, BM2
1686
1854
  return idf * (d + tf * (k + 1)) / (tf + k * (1 - b + b * fieldLength / averageFieldLength));
1687
1855
  }
1688
1856
 
1689
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/index.js
1857
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/cosine-similarity.js
1858
+ function getMagnitude(vector, vectorLength) {
1859
+ let magnitude = 0;
1860
+ for (let i = 0; i < vectorLength; i++) {
1861
+ magnitude += vector[i] * vector[i];
1862
+ }
1863
+ return Math.sqrt(magnitude);
1864
+ }
1865
+
1866
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/index.js
1690
1867
  async function insertDocumentScoreParameters(index, prop, id, tokens, docsCount) {
1691
1868
  var _a2;
1869
+ const internalId = getInternalDocumentId(index.sharedInternalDocumentStore, id);
1692
1870
  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] = {};
1871
+ index.fieldLengths[prop][internalId] = tokens.length;
1872
+ index.frequencies[prop][internalId] = {};
1695
1873
  }
1696
1874
  async function insertTokenScoreParameters(index, prop, id, tokens, token) {
1697
1875
  var _a2;
@@ -1701,51 +1879,55 @@ async function insertTokenScoreParameters(index, prop, id, tokens, token) {
1701
1879
  tokenFrequency++;
1702
1880
  }
1703
1881
  }
1882
+ const internalId = getInternalDocumentId(index.sharedInternalDocumentStore, id);
1704
1883
  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;
1884
+ index.frequencies[prop][internalId][token] = tf;
1885
+ if (!(token in index.tokenOccurrences[prop])) {
1886
+ index.tokenOccurrences[prop][token] = 0;
1708
1887
  }
1709
- index.tokenOccurrencies[prop][token] = ((_a2 = index.tokenOccurrencies[prop][token]) != null ? _a2 : 0) + 1;
1888
+ index.tokenOccurrences[prop][token] = ((_a2 = index.tokenOccurrences[prop][token]) != null ? _a2 : 0) + 1;
1710
1889
  }
1711
1890
  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;
1891
+ const internalId = getInternalDocumentId(index.sharedInternalDocumentStore, id);
1892
+ index.avgFieldLength[prop] = (index.avgFieldLength[prop] * docsCount - index.fieldLengths[prop][internalId]) / (docsCount - 1);
1893
+ index.fieldLengths[prop][internalId] = void 0;
1894
+ index.frequencies[prop][internalId] = void 0;
1715
1895
  }
1716
1896
  async function removeTokenScoreParameters(index, prop, token) {
1717
- index.tokenOccurrencies[prop][token]--;
1897
+ index.tokenOccurrences[prop][token]--;
1718
1898
  }
1719
1899
  async function calculateResultScores(context, index, prop, term, ids) {
1720
1900
  var _a2, _b;
1721
1901
  const documentIDs = Array.from(ids);
1722
1902
  const avgFieldLength = index.avgFieldLength[prop];
1723
1903
  const fieldLengths = index.fieldLengths[prop];
1724
- const oramaOccurrencies = index.tokenOccurrencies[prop];
1904
+ const oramaOccurrences = index.tokenOccurrences[prop];
1725
1905
  const oramaFrequencies = index.frequencies[prop];
1726
- const termOccurrencies = typeof oramaOccurrencies[term] === "number" ? (_a2 = oramaOccurrencies[term]) != null ? _a2 : 0 : 0;
1906
+ const termOccurrences = typeof oramaOccurrences[term] === "number" ? (_a2 = oramaOccurrences[term]) != null ? _a2 : 0 : 0;
1727
1907
  const scoreList = [];
1728
1908
  const documentIDsLength = documentIDs.length;
1729
1909
  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);
1910
+ var _oramaFrequencies_internalId;
1911
+ const internalId = getInternalDocumentId(index.sharedInternalDocumentStore, documentIDs[k]);
1912
+ 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;
1913
+ const bm25 = BM25(tf, termOccurrences, context.docsCount, fieldLengths[internalId], avgFieldLength, context.params.relevance);
1734
1914
  scoreList.push([
1735
- id,
1915
+ internalId,
1736
1916
  bm25
1737
1917
  ]);
1738
1918
  }
1739
1919
  return scoreList;
1740
1920
  }
1741
- async function create4(orama, schema, index, prefix = "") {
1921
+ async function create4(orama, sharedInternalDocumentStore, schema, index, prefix = "") {
1742
1922
  if (!index) {
1743
1923
  index = {
1924
+ sharedInternalDocumentStore,
1744
1925
  indexes: {},
1926
+ vectorIndexes: {},
1745
1927
  searchableProperties: [],
1746
1928
  searchablePropertiesWithTypes: {},
1747
1929
  frequencies: {},
1748
- tokenOccurrencies: {},
1930
+ tokenOccurrences: {},
1749
1931
  avgFieldLength: {},
1750
1932
  fieldLengths: {}
1751
1933
  };
@@ -1754,71 +1936,133 @@ async function create4(orama, schema, index, prefix = "") {
1754
1936
  const typeActualType = typeof type;
1755
1937
  const path = `${prefix}${prefix ? "." : ""}${prop}`;
1756
1938
  if (typeActualType === "object" && !Array.isArray(type)) {
1757
- create4(orama, type, index, path);
1939
+ create4(orama, sharedInternalDocumentStore, type, index, path);
1758
1940
  continue;
1759
1941
  }
1760
- switch (type) {
1761
- case "boolean":
1762
- index.indexes[path] = {
1763
- true: [],
1764
- false: []
1765
- };
1766
- break;
1767
- case "number":
1768
- index.indexes[path] = create2(0, []);
1769
- break;
1770
- case "string":
1771
- index.indexes[path] = create3();
1772
- index.avgFieldLength[path] = 0;
1773
- index.frequencies[path] = {};
1774
- index.tokenOccurrencies[path] = {};
1775
- index.fieldLengths[path] = {};
1776
- break;
1777
- default:
1778
- throw createError("INVALID_SCHEMA_TYPE", Array.isArray(type) ? "array" : typeActualType);
1942
+ if (isVectorType(type)) {
1943
+ index.searchableProperties.push(path);
1944
+ index.searchablePropertiesWithTypes[path] = type;
1945
+ index.vectorIndexes[path] = {
1946
+ size: getVectorSize(type),
1947
+ vectors: {}
1948
+ };
1949
+ } else {
1950
+ switch (type) {
1951
+ case "boolean":
1952
+ case "boolean[]":
1953
+ index.indexes[path] = {
1954
+ true: [],
1955
+ false: []
1956
+ };
1957
+ break;
1958
+ case "number":
1959
+ case "number[]":
1960
+ index.indexes[path] = create2(0, []);
1961
+ break;
1962
+ case "string":
1963
+ case "string[]":
1964
+ index.indexes[path] = create3();
1965
+ index.avgFieldLength[path] = 0;
1966
+ index.frequencies[path] = {};
1967
+ index.tokenOccurrences[path] = {};
1968
+ index.fieldLengths[path] = {};
1969
+ break;
1970
+ default:
1971
+ throw createError("INVALID_SCHEMA_TYPE", Array.isArray(type) ? "array" : type, path);
1972
+ }
1973
+ index.searchableProperties.push(path);
1974
+ index.searchablePropertiesWithTypes[path] = type;
1779
1975
  }
1780
- index.searchableProperties.push(path);
1781
- index.searchablePropertiesWithTypes[path] = type;
1782
1976
  }
1783
1977
  return index;
1784
1978
  }
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;
1979
+ async function insertScalar(implementation, index, prop, id, value, schemaType, language, tokenizer, docsCount) {
1980
+ const internalId = getInternalDocumentId(index.sharedInternalDocumentStore, id);
1981
+ switch (schemaType) {
1982
+ case "boolean": {
1983
+ const booleanIndex = index.indexes[prop];
1984
+ booleanIndex[value ? "true" : "false"].push(internalId);
1985
+ break;
1986
+ }
1987
+ case "number":
1988
+ insert(index.indexes[prop], value, [
1989
+ internalId
1990
+ ]);
1991
+ break;
1992
+ case "string": {
1993
+ const tokens = await tokenizer.tokenize(value, language, prop);
1994
+ await implementation.insertDocumentScoreParameters(index, prop, internalId, tokens, docsCount);
1995
+ for (const token of tokens) {
1996
+ await implementation.insertTokenScoreParameters(index, prop, internalId, tokens, token);
1997
+ insert2(index.indexes[prop], token, internalId);
1998
+ }
1999
+ break;
2000
+ }
2001
+ }
2002
+ }
2003
+ async function insert3(implementation, index, prop, id, value, schemaType, language, tokenizer, docsCount) {
2004
+ if (isVectorType(schemaType)) {
2005
+ return insertVector(index, prop, value, id);
2006
+ }
2007
+ if (!isArrayType(schemaType)) {
2008
+ return insertScalar(implementation, index, prop, id, value, schemaType, language, tokenizer, docsCount);
1794
2009
  }
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);
2010
+ const innerSchemaType = getInnerType(schemaType);
2011
+ const elements = value;
2012
+ const elementsLength = elements.length;
2013
+ for (let i = 0; i < elementsLength; i++) {
2014
+ await insertScalar(implementation, index, prop, id, elements[i], innerSchemaType, language, tokenizer, docsCount);
1800
2015
  }
1801
2016
  }
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;
2017
+ function insertVector(index, prop, value, id) {
2018
+ if (!(value instanceof Float32Array)) {
2019
+ value = new Float32Array(value);
2020
+ }
2021
+ const size = index.vectorIndexes[prop].size;
2022
+ const magnitude = getMagnitude(value, size);
2023
+ index.vectorIndexes[prop].vectors[id] = [
2024
+ magnitude,
2025
+ value
2026
+ ];
2027
+ }
2028
+ async function removeScalar(implementation, index, prop, id, value, schemaType, language, tokenizer, docsCount) {
2029
+ const internalId = getInternalDocumentId(index.sharedInternalDocumentStore, id);
2030
+ switch (schemaType) {
2031
+ case "number": {
2032
+ removeDocument(index.indexes[prop], internalId, value);
2033
+ return true;
2034
+ }
2035
+ case "boolean": {
2036
+ const booleanKey = value ? "true" : "false";
2037
+ const position = index.indexes[prop][booleanKey].indexOf(internalId);
2038
+ index.indexes[prop][value ? "true" : "false"].splice(position, 1);
2039
+ return true;
2040
+ }
2041
+ case "string": {
2042
+ const tokens = await tokenizer.tokenize(value, language, prop);
2043
+ await implementation.removeDocumentScoreParameters(index, prop, id, docsCount);
2044
+ for (const token of tokens) {
2045
+ await implementation.removeTokenScoreParameters(index, prop, token);
2046
+ removeDocumentByWord(index.indexes[prop], token, internalId);
2047
+ }
2048
+ return true;
2049
+ }
1811
2050
  }
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);
2051
+ }
2052
+ async function remove3(implementation, index, prop, id, value, schemaType, language, tokenizer, docsCount) {
2053
+ if (!isArrayType(schemaType)) {
2054
+ return removeScalar(implementation, index, prop, id, value, schemaType, language, tokenizer, docsCount);
2055
+ }
2056
+ const innerSchemaType = getInnerType(schemaType);
2057
+ const elements = value;
2058
+ const elementsLength = elements.length;
2059
+ for (let i = 0; i < elementsLength; i++) {
2060
+ await removeScalar(implementation, index, prop, id, elements[i], innerSchemaType, language, tokenizer, docsCount);
1817
2061
  }
1818
2062
  return true;
1819
2063
  }
1820
2064
  async function search(context, index, prop, term) {
1821
- if (!(prop in index.tokenOccurrencies)) {
2065
+ if (!(prop in index.tokenOccurrences)) {
1822
2066
  return [];
1823
2067
  }
1824
2068
  const rootNode = index.indexes[prop];
@@ -1846,12 +2090,18 @@ async function searchByWhereClause(context, index, filters) {
1846
2090
  const operation = filters[param];
1847
2091
  if (typeof operation === "boolean") {
1848
2092
  const idx = index.indexes[param];
2093
+ if (typeof idx === "undefined") {
2094
+ throw createError("UNKNOWN_FILTER_PROPERTY", param);
2095
+ }
1849
2096
  const filteredIDs = idx[operation.toString()];
1850
2097
  filtersMap[param].push(...filteredIDs);
1851
2098
  continue;
1852
2099
  }
1853
2100
  if (typeof operation === "string" || Array.isArray(operation)) {
1854
2101
  const idx = index.indexes[param];
2102
+ if (typeof idx === "undefined") {
2103
+ throw createError("UNKNOWN_FILTER_PROPERTY", param);
2104
+ }
1855
2105
  for (const raw of [
1856
2106
  operation
1857
2107
  ].flat()) {
@@ -1871,6 +2121,9 @@ async function searchByWhereClause(context, index, filters) {
1871
2121
  const operationOpt = operationKeys[0];
1872
2122
  const operationValue = operation[operationOpt];
1873
2123
  const AVLNode = index.indexes[param];
2124
+ if (typeof AVLNode === "undefined") {
2125
+ throw createError("UNKNOWN_FILTER_PROPERTY", param);
2126
+ }
1874
2127
  switch (operationOpt) {
1875
2128
  case "gt": {
1876
2129
  const filteredIDs = greaterThan(AVLNode, operationValue, false);
@@ -1913,26 +2166,75 @@ async function getSearchableProperties(index) {
1913
2166
  async function getSearchablePropertiesWithTypes(index) {
1914
2167
  return index.searchablePropertiesWithTypes;
1915
2168
  }
1916
- async function load2(raw) {
1917
- const { indexes, searchableProperties, searchablePropertiesWithTypes, frequencies, tokenOccurrencies, avgFieldLength, fieldLengths } = raw;
2169
+ function loadNode(node) {
2170
+ const convertedNode = create3(node.end, node.subWord, node.key);
2171
+ convertedNode.docs = node.docs;
2172
+ convertedNode.word = node.word;
2173
+ for (const childrenKey of Object.keys(node.children)) {
2174
+ convertedNode.children[childrenKey] = loadNode(node.children[childrenKey]);
2175
+ }
2176
+ return convertedNode;
2177
+ }
2178
+ async function load3(sharedInternalDocumentStore, raw) {
2179
+ const { indexes: rawIndexes, vectorIndexes: rawVectorIndexes, searchableProperties, searchablePropertiesWithTypes, frequencies, tokenOccurrences, avgFieldLength, fieldLengths } = raw;
2180
+ const indexes = {};
2181
+ const vectorIndexes = {};
2182
+ for (const prop of Object.keys(rawIndexes)) {
2183
+ const value = rawIndexes[prop];
2184
+ if (!("word" in value)) {
2185
+ indexes[prop] = value;
2186
+ continue;
2187
+ }
2188
+ indexes[prop] = loadNode(value);
2189
+ }
2190
+ for (const idx of Object.keys(rawVectorIndexes)) {
2191
+ const vectors = rawVectorIndexes[idx].vectors;
2192
+ for (const vec in vectors) {
2193
+ vectors[vec] = [
2194
+ vectors[vec][0],
2195
+ new Float32Array(vectors[vec][1])
2196
+ ];
2197
+ }
2198
+ vectorIndexes[idx] = {
2199
+ size: rawVectorIndexes[idx].size,
2200
+ vectors
2201
+ };
2202
+ }
1918
2203
  return {
2204
+ sharedInternalDocumentStore,
1919
2205
  indexes,
2206
+ vectorIndexes,
1920
2207
  searchableProperties,
1921
2208
  searchablePropertiesWithTypes,
1922
2209
  frequencies,
1923
- tokenOccurrencies,
2210
+ tokenOccurrences,
1924
2211
  avgFieldLength,
1925
2212
  fieldLengths
1926
2213
  };
1927
2214
  }
1928
- async function save2(index) {
1929
- const { indexes, searchableProperties, searchablePropertiesWithTypes, frequencies, tokenOccurrencies, avgFieldLength, fieldLengths } = index;
2215
+ async function save3(index) {
2216
+ const { indexes, vectorIndexes, searchableProperties, searchablePropertiesWithTypes, frequencies, tokenOccurrences, avgFieldLength, fieldLengths } = index;
2217
+ const vectorIndexesAsArrays = {};
2218
+ for (const idx of Object.keys(vectorIndexes)) {
2219
+ const vectors = vectorIndexes[idx].vectors;
2220
+ for (const vec in vectors) {
2221
+ vectors[vec] = [
2222
+ vectors[vec][0],
2223
+ Array.from(vectors[vec][1])
2224
+ ];
2225
+ }
2226
+ vectorIndexesAsArrays[idx] = {
2227
+ size: vectorIndexes[idx].size,
2228
+ vectors
2229
+ };
2230
+ }
1930
2231
  return {
1931
2232
  indexes,
2233
+ vectorIndexes: vectorIndexesAsArrays,
1932
2234
  searchableProperties,
1933
2235
  searchablePropertiesWithTypes,
1934
2236
  frequencies,
1935
- tokenOccurrencies,
2237
+ tokenOccurrences,
1936
2238
  avgFieldLength,
1937
2239
  fieldLengths
1938
2240
  };
@@ -1951,12 +2253,12 @@ async function createIndex() {
1951
2253
  searchByWhereClause,
1952
2254
  getSearchableProperties,
1953
2255
  getSearchablePropertiesWithTypes,
1954
- load: load2,
1955
- save: save2
2256
+ load: load3,
2257
+ save: save3
1956
2258
  };
1957
2259
  }
1958
2260
 
1959
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/diacritics.js
2261
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/tokenizer/diacritics.js
1960
2262
  var DIACRITICS_CHARCODE_START = 192;
1961
2263
  var DIACRITICS_CHARCODE_END = 383;
1962
2264
  var CHARCODE_REPLACE_MAPPING = [
@@ -2166,2317 +2468,7 @@ function replaceDiacritics(str) {
2166
2468
  return String.fromCharCode(...stringCharCode);
2167
2469
  }
2168
2470
 
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
2471
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/tokenizer/english-stemmer.js
4480
2472
  var step2List = {
4481
2473
  ational: "ate",
4482
2474
  tional: "tion",
@@ -4636,7 +2628,7 @@ function stemmer(w) {
4636
2628
  return w;
4637
2629
  }
4638
2630
 
4639
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/tokenizer/index.js
2631
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/tokenizer/index.js
4640
2632
  function normalizeToken(prop, token) {
4641
2633
  var _this_stopWords;
4642
2634
  const key = `${this.language}:${prop}:${token}`;
@@ -4681,7 +2673,6 @@ function tokenize(input, language, prop) {
4681
2673
  return trimTokens;
4682
2674
  }
4683
2675
  async function createTokenizer(config = {}) {
4684
- var _a2;
4685
2676
  if (!config.language) {
4686
2677
  config.language = "english";
4687
2678
  } else if (!SUPPORTED_LANGUAGES.includes(config.language)) {
@@ -4702,20 +2693,20 @@ async function createTokenizer(config = {}) {
4702
2693
  }
4703
2694
  }
4704
2695
  }
4705
- let stopWords2;
2696
+ let stopWords;
4706
2697
  if (config.stopWords !== false) {
4707
- stopWords2 = (_a2 = stopWords[config.language]) != null ? _a2 : [];
2698
+ stopWords = [];
4708
2699
  if (Array.isArray(config.stopWords)) {
4709
- stopWords2 = config.stopWords;
2700
+ stopWords = config.stopWords;
4710
2701
  } else if (typeof config.stopWords === "function") {
4711
- stopWords2 = await config.stopWords(stopWords2);
2702
+ stopWords = await config.stopWords(stopWords);
4712
2703
  } else if (config.stopWords) {
4713
2704
  throw createError("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");
4714
2705
  }
4715
- if (!Array.isArray(stopWords2)) {
2706
+ if (!Array.isArray(stopWords)) {
4716
2707
  throw createError("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");
4717
2708
  }
4718
- for (const s of stopWords2) {
2709
+ for (const s of stopWords) {
4719
2710
  if (typeof s !== "string") {
4720
2711
  throw createError("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");
4721
2712
  }
@@ -4728,7 +2719,7 @@ async function createTokenizer(config = {}) {
4728
2719
  stemmerSkipProperties: new Set(config.stemmerSkipProperties ? [
4729
2720
  config.stemmerSkipProperties
4730
2721
  ].flat() : []),
4731
- stopWords: stopWords2,
2722
+ stopWords,
4732
2723
  allowDuplicates: Boolean(config.allowDuplicates),
4733
2724
  normalizeToken,
4734
2725
  normalizationCache: /* @__PURE__ */ new Map()
@@ -4738,7 +2729,257 @@ async function createTokenizer(config = {}) {
4738
2729
  return tokenizer;
4739
2730
  }
4740
2731
 
4741
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/methods/create.js
2732
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/sorter.js
2733
+ function innerCreate(orama, sharedInternalDocumentStore, schema, sortableDeniedProperties, prefix) {
2734
+ const sorter = {
2735
+ language: orama.tokenizer.language,
2736
+ sharedInternalDocumentStore,
2737
+ enabled: true,
2738
+ isSorted: true,
2739
+ sortableProperties: [],
2740
+ sortablePropertiesWithTypes: {},
2741
+ sorts: {}
2742
+ };
2743
+ for (const [prop, type] of Object.entries(schema)) {
2744
+ const typeActualType = typeof type;
2745
+ const path = `${prefix}${prefix ? "." : ""}${prop}`;
2746
+ if (sortableDeniedProperties.includes(path)) {
2747
+ continue;
2748
+ }
2749
+ if (typeActualType === "object" && !Array.isArray(type)) {
2750
+ const ret = innerCreate(orama, sharedInternalDocumentStore, type, sortableDeniedProperties, path);
2751
+ sorter.sortableProperties.push(...ret.sortableProperties);
2752
+ sorter.sorts = __spreadValues(__spreadValues({}, sorter.sorts), ret.sorts);
2753
+ sorter.sortablePropertiesWithTypes = __spreadValues(__spreadValues({}, sorter.sortablePropertiesWithTypes), ret.sortablePropertiesWithTypes);
2754
+ continue;
2755
+ }
2756
+ if (!isVectorType(type)) {
2757
+ switch (type) {
2758
+ case "boolean":
2759
+ case "number":
2760
+ case "string":
2761
+ sorter.sortableProperties.push(path);
2762
+ sorter.sortablePropertiesWithTypes[path] = type;
2763
+ sorter.sorts[path] = {
2764
+ docs: /* @__PURE__ */ new Map(),
2765
+ orderedDocsToRemove: /* @__PURE__ */ new Map(),
2766
+ orderedDocs: [],
2767
+ type
2768
+ };
2769
+ break;
2770
+ case "boolean[]":
2771
+ case "number[]":
2772
+ case "string[]":
2773
+ continue;
2774
+ default:
2775
+ throw createError("INVALID_SORT_SCHEMA_TYPE", Array.isArray(type) ? "array" : type, path);
2776
+ }
2777
+ }
2778
+ }
2779
+ return sorter;
2780
+ }
2781
+ async function create5(orama, sharedInternalDocumentStore, schema, config) {
2782
+ const isSortEnabled = (config === null || config === void 0 ? void 0 : config.enabled) !== false;
2783
+ if (!isSortEnabled) {
2784
+ return {
2785
+ disabled: true
2786
+ };
2787
+ }
2788
+ return innerCreate(orama, sharedInternalDocumentStore, schema, (config || {}).unsortableProperties || [], "");
2789
+ }
2790
+ async function insert4(sorter, prop, id, value) {
2791
+ if (!sorter.enabled) {
2792
+ return;
2793
+ }
2794
+ sorter.isSorted = false;
2795
+ const internalId = getInternalDocumentId(sorter.sharedInternalDocumentStore, id);
2796
+ const s = sorter.sorts[prop];
2797
+ s.docs.set(internalId, s.orderedDocs.length);
2798
+ s.orderedDocs.push([
2799
+ internalId,
2800
+ value
2801
+ ]);
2802
+ }
2803
+ function ensureIsSorted(sorter) {
2804
+ if (sorter.isSorted) {
2805
+ return;
2806
+ }
2807
+ if (!sorter.enabled) {
2808
+ return;
2809
+ }
2810
+ const properties = Object.keys(sorter.sorts);
2811
+ for (const prop of properties) {
2812
+ ensurePropertyIsSorted(sorter, prop);
2813
+ }
2814
+ sorter.isSorted = true;
2815
+ }
2816
+ function stringSort(language, value, d) {
2817
+ return value[1].localeCompare(d[1], language);
2818
+ }
2819
+ function numberSort(value, d) {
2820
+ return value[1] - d[1];
2821
+ }
2822
+ function booleanSort(value, d) {
2823
+ return d[1] ? -1 : 1;
2824
+ }
2825
+ function ensurePropertyIsSorted(sorter, prop) {
2826
+ const s = sorter.sorts[prop];
2827
+ let predicate;
2828
+ switch (s.type) {
2829
+ case "string":
2830
+ predicate = stringSort.bind(null, sorter.language);
2831
+ break;
2832
+ case "number":
2833
+ predicate = numberSort.bind(null);
2834
+ break;
2835
+ case "boolean":
2836
+ predicate = booleanSort.bind(null);
2837
+ break;
2838
+ }
2839
+ s.orderedDocs.sort(predicate);
2840
+ const orderedDocsLength = s.orderedDocs.length;
2841
+ for (let i = 0; i < orderedDocsLength; i++) {
2842
+ const docId = s.orderedDocs[i][0];
2843
+ s.docs.set(docId, i);
2844
+ }
2845
+ }
2846
+ function ensureOrderedDocsAreDeleted(sorter) {
2847
+ const properties = Object.keys(sorter.sorts);
2848
+ for (const prop of properties) {
2849
+ ensureOrderedDocsAreDeletedByProperty(sorter, prop);
2850
+ }
2851
+ }
2852
+ function ensureOrderedDocsAreDeletedByProperty(sorter, prop) {
2853
+ const s = sorter.sorts[prop];
2854
+ if (!s.orderedDocsToRemove.size)
2855
+ return;
2856
+ s.orderedDocs = s.orderedDocs.filter((doc) => !s.orderedDocsToRemove.has(doc[0]));
2857
+ s.orderedDocsToRemove.clear();
2858
+ }
2859
+ async function remove4(sorter, prop, id) {
2860
+ if (!sorter.enabled) {
2861
+ return;
2862
+ }
2863
+ const s = sorter.sorts[prop];
2864
+ const internalId = getInternalDocumentId(sorter.sharedInternalDocumentStore, id);
2865
+ const index = s.docs.get(internalId);
2866
+ if (!index)
2867
+ return;
2868
+ s.docs.delete(internalId);
2869
+ s.orderedDocsToRemove.set(internalId, true);
2870
+ }
2871
+ async function sortBy(sorter, docIds, by) {
2872
+ if (!sorter.enabled) {
2873
+ throw createError("SORT_DISABLED");
2874
+ }
2875
+ const property = by.property;
2876
+ const isDesc = by.order === "DESC";
2877
+ const s = sorter.sorts[property];
2878
+ if (!s) {
2879
+ throw createError("UNABLE_TO_SORT_ON_UNKNOWN_FIELD", property, sorter.sortableProperties.join(", "));
2880
+ }
2881
+ ensureOrderedDocsAreDeletedByProperty(sorter, property);
2882
+ ensureIsSorted(sorter);
2883
+ docIds.sort((a, b) => {
2884
+ const indexOfA = s.docs.get(getInternalDocumentId(sorter.sharedInternalDocumentStore, a[0]));
2885
+ const indexOfB = s.docs.get(getInternalDocumentId(sorter.sharedInternalDocumentStore, b[0]));
2886
+ const isAIndexed = typeof indexOfA !== "undefined";
2887
+ const isBIndexed = typeof indexOfB !== "undefined";
2888
+ if (!isAIndexed && !isBIndexed) {
2889
+ return 0;
2890
+ }
2891
+ if (!isAIndexed) {
2892
+ return 1;
2893
+ }
2894
+ if (!isBIndexed) {
2895
+ return -1;
2896
+ }
2897
+ return isDesc ? indexOfB - indexOfA : indexOfA - indexOfB;
2898
+ });
2899
+ return docIds;
2900
+ }
2901
+ async function getSortableProperties(sorter) {
2902
+ if (!sorter.enabled) {
2903
+ return [];
2904
+ }
2905
+ return sorter.sortableProperties;
2906
+ }
2907
+ async function getSortablePropertiesWithTypes(sorter) {
2908
+ if (!sorter.enabled) {
2909
+ return {};
2910
+ }
2911
+ return sorter.sortablePropertiesWithTypes;
2912
+ }
2913
+ async function load4(sharedInternalDocumentStore, raw) {
2914
+ const rawDocument = raw;
2915
+ if (!rawDocument.enabled) {
2916
+ return {
2917
+ enabled: false
2918
+ };
2919
+ }
2920
+ const sorts = Object.keys(rawDocument.sorts).reduce((acc, prop) => {
2921
+ const { docs, orderedDocs, type } = rawDocument.sorts[prop];
2922
+ acc[prop] = {
2923
+ docs: new Map(Object.entries(docs).map(([k, v2]) => [
2924
+ +k,
2925
+ v2
2926
+ ])),
2927
+ orderedDocsToRemove: /* @__PURE__ */ new Map(),
2928
+ orderedDocs,
2929
+ type
2930
+ };
2931
+ return acc;
2932
+ }, {});
2933
+ return {
2934
+ sharedInternalDocumentStore,
2935
+ language: rawDocument.language,
2936
+ sortableProperties: rawDocument.sortableProperties,
2937
+ sortablePropertiesWithTypes: rawDocument.sortablePropertiesWithTypes,
2938
+ sorts,
2939
+ enabled: true,
2940
+ isSorted: rawDocument.isSorted
2941
+ };
2942
+ }
2943
+ async function save4(sorter) {
2944
+ if (!sorter.enabled) {
2945
+ return {
2946
+ enabled: false
2947
+ };
2948
+ }
2949
+ ensureOrderedDocsAreDeleted(sorter);
2950
+ ensureIsSorted(sorter);
2951
+ const sorts = Object.keys(sorter.sorts).reduce((acc, prop) => {
2952
+ const { docs, orderedDocs, type } = sorter.sorts[prop];
2953
+ acc[prop] = {
2954
+ docs: Object.fromEntries(docs.entries()),
2955
+ orderedDocs,
2956
+ type
2957
+ };
2958
+ return acc;
2959
+ }, {});
2960
+ return {
2961
+ language: sorter.language,
2962
+ sortableProperties: sorter.sortableProperties,
2963
+ sortablePropertiesWithTypes: sorter.sortablePropertiesWithTypes,
2964
+ sorts,
2965
+ enabled: sorter.enabled,
2966
+ isSorted: sorter.isSorted
2967
+ };
2968
+ }
2969
+ async function createSorter() {
2970
+ return {
2971
+ create: create5,
2972
+ insert: insert4,
2973
+ remove: remove4,
2974
+ save: save4,
2975
+ load: load4,
2976
+ sortBy,
2977
+ getSortableProperties,
2978
+ getSortablePropertiesWithTypes
2979
+ };
2980
+ }
2981
+
2982
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/methods/create.js
4742
2983
  function validateComponents(components) {
4743
2984
  const defaultComponents = {
4744
2985
  formatElapsedTime,
@@ -4758,7 +2999,8 @@ function validateComponents(components) {
4758
2999
  }
4759
3000
  for (const rawKey of SINGLE_OR_ARRAY_COMPONENTS) {
4760
3001
  const key = rawKey;
4761
- if (!components[key]) {
3002
+ const component = components[key];
3003
+ if (!component) {
4762
3004
  components[key] = [];
4763
3005
  } else if (!Array.isArray(components[key])) {
4764
3006
  components[key] = [
@@ -4777,7 +3019,7 @@ function validateComponents(components) {
4777
3019
  }
4778
3020
  }
4779
3021
  }
4780
- async function create5({ schema, language, components, id }) {
3022
+ async function create6({ schema, sort, language, components, id }) {
4781
3023
  if (!components) {
4782
3024
  components = {};
4783
3025
  }
@@ -4787,6 +3029,7 @@ async function create5({ schema, language, components, id }) {
4787
3029
  let tokenizer = components.tokenizer;
4788
3030
  let index = components.index;
4789
3031
  let documentsStore = components.documentsStore;
3032
+ let sorter = components.sorter;
4790
3033
  if (!tokenizer) {
4791
3034
  tokenizer = await createTokenizer({
4792
3035
  language: language != null ? language : "english"
@@ -4797,21 +3040,21 @@ async function create5({ schema, language, components, id }) {
4797
3040
  if (components.tokenizer && language) {
4798
3041
  throw createError("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");
4799
3042
  }
4800
- if (!index) {
4801
- index = await createIndex();
4802
- }
4803
- if (!documentsStore) {
4804
- documentsStore = await createDocumentsStore();
4805
- }
3043
+ const internalDocumentStore = createInternalDocumentIDStore();
3044
+ index || (index = await createIndex());
3045
+ sorter || (sorter = await createSorter());
3046
+ documentsStore || (documentsStore = await createDocumentsStore());
4806
3047
  validateComponents(components);
4807
- const { getDocumentProperties: getDocumentProperties2, getDocumentIndexId: getDocumentIndexId2, validateSchema: validateSchema2, beforeInsert, afterInsert, beforeRemove, afterRemove, beforeMultipleInsert, afterMultipleInsert, beforeMultipleRemove, afterMultipleRemove, formatElapsedTime: formatElapsedTime2 } = components;
3048
+ const { getDocumentProperties: getDocumentProperties2, getDocumentIndexId: getDocumentIndexId2, validateSchema: validateSchema2, beforeInsert, afterInsert, beforeRemove, afterRemove, beforeUpdate, afterUpdate, afterSearch, beforeMultipleInsert, afterMultipleInsert, beforeMultipleRemove, afterMultipleRemove, beforeMultipleUpdate, afterMultipleUpdate, formatElapsedTime: formatElapsedTime2 } = components;
4808
3049
  const orama = {
4809
3050
  data: {},
4810
3051
  caches: {},
4811
3052
  schema,
4812
3053
  tokenizer,
4813
3054
  index,
3055
+ sorter,
4814
3056
  documentsStore,
3057
+ internalDocumentIDStore: internalDocumentStore,
4815
3058
  getDocumentProperties: getDocumentProperties2,
4816
3059
  getDocumentIndexId: getDocumentIndexId2,
4817
3060
  validateSchema: validateSchema2,
@@ -4819,25 +3062,31 @@ async function create5({ schema, language, components, id }) {
4819
3062
  afterInsert,
4820
3063
  beforeRemove,
4821
3064
  afterRemove,
3065
+ beforeUpdate,
3066
+ afterUpdate,
3067
+ afterSearch,
4822
3068
  beforeMultipleInsert,
4823
3069
  afterMultipleInsert,
4824
3070
  beforeMultipleRemove,
4825
3071
  afterMultipleRemove,
3072
+ beforeMultipleUpdate,
3073
+ afterMultipleUpdate,
4826
3074
  formatElapsedTime: formatElapsedTime2,
4827
3075
  id
4828
3076
  };
4829
3077
  orama.data = {
4830
- index: await orama.index.create(orama, schema),
4831
- docs: await orama.documentsStore.create(orama)
3078
+ index: await orama.index.create(orama, internalDocumentStore, schema),
3079
+ docs: await orama.documentsStore.create(orama, internalDocumentStore),
3080
+ sorting: await orama.sorter.create(orama, internalDocumentStore, schema, sort)
4832
3081
  };
4833
3082
  return orama;
4834
3083
  }
4835
3084
 
4836
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/types.js
3085
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/types.js
4837
3086
  var kInsertions = Symbol("orama.insertions");
4838
3087
  var kRemovals = Symbol("orama.removals");
4839
3088
 
4840
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/sync-blocking-checker.js
3089
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/sync-blocking-checker.js
4841
3090
  var _globalThis_process;
4842
3091
  var _a;
4843
3092
  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 +3125,15 @@ function trackRemoval(orama) {
4876
3125
  }
4877
3126
  }
4878
3127
 
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);
3128
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/methods/insert.js
3129
+ async function insert5(orama, doc, language, skipHooks) {
3130
+ const errorProperty = await orama.validateSchema(doc, orama.schema);
3131
+ if (errorProperty) {
3132
+ throw createError("SCHEMA_VALIDATION_FAILURE", errorProperty);
3133
+ }
3134
+ return innerInsert(orama, doc, language, skipHooks);
3135
+ }
3136
+ async function innerInsert(orama, doc, language, skipHooks) {
4882
3137
  const { index, docs } = orama.data;
4883
3138
  const id = await orama.getDocumentIndexId(doc);
4884
3139
  if (typeof id !== "string") {
@@ -4893,26 +3148,44 @@ async function insert4(orama, doc, language, skipHooks) {
4893
3148
  }
4894
3149
  const indexableProperties = await orama.index.getSearchableProperties(index);
4895
3150
  const indexablePropertiesWithTypes = await orama.index.getSearchablePropertiesWithTypes(index);
4896
- const values = await orama.getDocumentProperties(doc, indexableProperties);
4897
- for (const [key, value] of Object.entries(values)) {
3151
+ const indexableValues = await orama.getDocumentProperties(doc, indexableProperties);
3152
+ for (const [key, value] of Object.entries(indexableValues)) {
4898
3153
  if (typeof value === "undefined") {
4899
3154
  continue;
4900
3155
  }
4901
3156
  const actualType = typeof value;
4902
3157
  const expectedType = indexablePropertiesWithTypes[key];
3158
+ if (isVectorType(expectedType) && Array.isArray(value)) {
3159
+ continue;
3160
+ }
3161
+ if (isArrayType(expectedType) && Array.isArray(value)) {
3162
+ continue;
3163
+ }
4903
3164
  if (actualType !== expectedType) {
4904
3165
  throw createError("INVALID_DOCUMENT_PROPERTY", key, expectedType, actualType);
4905
3166
  }
4906
3167
  }
4907
3168
  for (const prop of indexableProperties) {
4908
3169
  var _orama_index, _orama_index_beforeInsert, _orama_index1, _orama_index_afterInsert;
4909
- const value = values[prop];
3170
+ const value = indexableValues[prop];
4910
3171
  if (typeof value === "undefined") {
4911
3172
  continue;
4912
3173
  }
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));
3174
+ const expectedType = indexablePropertiesWithTypes[prop];
3175
+ 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));
3176
+ await orama.index.insert(orama.index, orama.data.index, prop, id, value, expectedType, language, orama.tokenizer, docsCount);
3177
+ 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));
3178
+ }
3179
+ const sortableProperties = await orama.sorter.getSortableProperties(orama.data.sorting);
3180
+ const sortablePropertiesWithTypes = await orama.sorter.getSortablePropertiesWithTypes(orama.data.sorting);
3181
+ const sortableValues = await orama.getDocumentProperties(doc, sortableProperties);
3182
+ for (const prop of sortableProperties) {
3183
+ const value = sortableValues[prop];
3184
+ if (typeof value === "undefined") {
3185
+ continue;
3186
+ }
3187
+ const expectedType = sortablePropertiesWithTypes[prop];
3188
+ await orama.sorter.insert(orama.data.sorting, prop, id, value, expectedType, language);
4916
3189
  }
4917
3190
  if (!skipHooks) {
4918
3191
  await runSingleHook(orama.afterInsert, orama, id, doc);
@@ -4921,37 +3194,52 @@ async function insert4(orama, doc, language, skipHooks) {
4921
3194
  return id;
4922
3195
  }
4923
3196
 
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) {
3197
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/methods/remove.js
3198
+ async function remove5(orama, id, language, skipHooks) {
4926
3199
  let result = true;
4927
3200
  const { index, docs } = orama.data;
4928
3201
  const doc = await orama.documentsStore.get(docs, id);
4929
3202
  if (!doc) {
4930
- throw createError("DOCUMENT_DOES_NOT_EXIST", id);
3203
+ return false;
4931
3204
  }
3205
+ const docId = getDocumentIdFromInternalId(orama.internalDocumentIDStore, getInternalDocumentId(orama.internalDocumentIDStore, id));
4932
3206
  const docsCount = await orama.documentsStore.count(docs);
4933
3207
  if (!skipHooks) {
4934
- await runSingleHook(orama.beforeRemove, orama, id);
3208
+ await runSingleHook(orama.beforeRemove, orama, docId);
4935
3209
  }
4936
3210
  const indexableProperties = await orama.index.getSearchableProperties(index);
3211
+ const indexablePropertiesWithTypes = await orama.index.getSearchablePropertiesWithTypes(index);
4937
3212
  const values = await orama.getDocumentProperties(doc, indexableProperties);
4938
3213
  for (const prop of indexableProperties) {
4939
3214
  var _orama_index, _orama_index_beforeRemove, _orama_index1, _orama_index_afterRemove;
4940
3215
  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)) {
3216
+ if (typeof value === "undefined") {
3217
+ continue;
3218
+ }
3219
+ const schemaType = indexablePropertiesWithTypes[prop];
3220
+ 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));
3221
+ if (!await orama.index.remove(orama.index, orama.data.index, prop, id, value, schemaType, language, orama.tokenizer, docsCount)) {
4943
3222
  result = false;
4944
3223
  }
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));
3224
+ 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));
3225
+ }
3226
+ const sortableProperties = await orama.sorter.getSortableProperties(orama.data.sorting);
3227
+ const sortableValues = await orama.getDocumentProperties(doc, sortableProperties);
3228
+ for (const prop of sortableProperties) {
3229
+ if (typeof sortableValues[prop] === "undefined") {
3230
+ continue;
3231
+ }
3232
+ await orama.sorter.remove(orama.data.sorting, prop, id);
4946
3233
  }
4947
3234
  if (!skipHooks) {
4948
- await runSingleHook(orama.afterRemove, orama, id);
3235
+ await runSingleHook(orama.afterRemove, orama, docId);
4949
3236
  }
3237
+ await orama.documentsStore.remove(orama.data.docs, id);
4950
3238
  trackRemoval(orama);
4951
3239
  return result;
4952
3240
  }
4953
3241
 
4954
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/facets.js
3242
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/facets.js
4955
3243
  function sortingPredicate(order = "desc", a, b) {
4956
3244
  if (order.toLowerCase() === "asc") {
4957
3245
  return a[1] - b[1];
@@ -4960,7 +3248,7 @@ function sortingPredicate(order = "desc", a, b) {
4960
3248
  }
4961
3249
  }
4962
3250
  async function getFacets(orama, results, facetsConfig) {
4963
- var _a2, _b, _c, _d;
3251
+ var _a2, _b;
4964
3252
  const facets = {};
4965
3253
  const allIDs = results.map(([id]) => id);
4966
3254
  const allDocs = await orama.documentsStore.getMultiple(orama.data.docs, allIDs);
@@ -4989,19 +3277,35 @@ async function getFacets(orama, results, facetsConfig) {
4989
3277
  const doc = allDocs[i];
4990
3278
  for (const facet of facetKeys) {
4991
3279
  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
- }
3280
+ const propertyType = properties[facet];
3281
+ switch (propertyType) {
3282
+ case "number": {
3283
+ const ranges = facetsConfig[facet].ranges;
3284
+ calculateNumberFacet(ranges, facets[facet].values, facetValue);
3285
+ break;
3286
+ }
3287
+ case "number[]": {
3288
+ const alreadyInsertedValues = /* @__PURE__ */ new Set();
3289
+ const ranges = facetsConfig[facet].ranges;
3290
+ for (const v2 of facetValue) {
3291
+ calculateNumberFacet(ranges, facets[facet].values, v2, alreadyInsertedValues);
5000
3292
  }
3293
+ break;
3294
+ }
3295
+ case "boolean":
3296
+ case "string": {
3297
+ calculateBooleanOrStringFacet(facets[facet].values, facetValue, propertyType);
3298
+ break;
3299
+ }
3300
+ case "boolean[]":
3301
+ case "string[]": {
3302
+ const alreadyInsertedValues = /* @__PURE__ */ new Set();
3303
+ const innerType = propertyType === "boolean[]" ? "boolean" : "string";
3304
+ for (const v2 of facetValue) {
3305
+ calculateBooleanOrStringFacet(facets[facet].values, v2, innerType, alreadyInsertedValues);
3306
+ }
3307
+ break;
5001
3308
  }
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
3309
  }
5006
3310
  }
5007
3311
  }
@@ -5009,13 +3313,42 @@ async function getFacets(orama, results, facetsConfig) {
5009
3313
  facets[facet].count = Object.keys(facets[facet].values).length;
5010
3314
  if (properties[facet] === "string") {
5011
3315
  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));
3316
+ 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
3317
  }
5014
3318
  }
5015
3319
  return facets;
5016
3320
  }
3321
+ function calculateNumberFacet(ranges, values, facetValue, alreadyInsertedValues) {
3322
+ for (const range of ranges) {
3323
+ const value = `${range.from}-${range.to}`;
3324
+ if (alreadyInsertedValues && alreadyInsertedValues.has(value)) {
3325
+ continue;
3326
+ }
3327
+ if (facetValue >= range.from && facetValue <= range.to) {
3328
+ if (values[value] === void 0) {
3329
+ values[value] = 1;
3330
+ } else {
3331
+ values[value]++;
3332
+ if (alreadyInsertedValues) {
3333
+ alreadyInsertedValues.add(value);
3334
+ }
3335
+ }
3336
+ }
3337
+ }
3338
+ }
3339
+ function calculateBooleanOrStringFacet(values, facetValue, propertyType, alreadyInsertedValues) {
3340
+ var _a2, _b;
3341
+ const value = (_a2 = facetValue === null || facetValue === void 0 ? void 0 : facetValue.toString()) != null ? _a2 : propertyType === "boolean" ? "false" : "";
3342
+ if (alreadyInsertedValues && alreadyInsertedValues.has(value)) {
3343
+ return;
3344
+ }
3345
+ values[value] = ((_b = values[value]) != null ? _b : 0) + 1;
3346
+ if (alreadyInsertedValues) {
3347
+ alreadyInsertedValues.add(value);
3348
+ }
3349
+ }
5017
3350
 
5018
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/components/filters.js
3351
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/filters.js
5019
3352
  function intersectFilteredIDs(filtered, lookedUp) {
5020
3353
  const map = /* @__PURE__ */ new Map();
5021
3354
  const result = [];
@@ -5034,13 +3367,143 @@ function intersectFilteredIDs(filtered, lookedUp) {
5034
3367
  return result;
5035
3368
  }
5036
3369
 
5037
- // ../../node_modules/.pnpm/@orama+orama@1.0.0-beta.16/node_modules/@orama/orama/dist/methods/search.js
3370
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/components/groups.js
3371
+ var DEFAULT_REDUCE = {
3372
+ reducer: (_, acc, res, index) => {
3373
+ acc[index] = res;
3374
+ return acc;
3375
+ },
3376
+ getInitialValue: (length) => Array.from({
3377
+ length
3378
+ })
3379
+ };
3380
+ var ALLOWED_TYPES = [
3381
+ "string",
3382
+ "number",
3383
+ "boolean"
3384
+ ];
3385
+ async function getGroups(orama, results, groupBy) {
3386
+ const properties = groupBy.properties;
3387
+ const propertiesLength = properties.length;
3388
+ const schemaProperties = await orama.index.getSearchablePropertiesWithTypes(orama.data.index);
3389
+ for (let i = 0; i < propertiesLength; i++) {
3390
+ const property = properties[i];
3391
+ if (typeof schemaProperties[property] === "undefined") {
3392
+ throw createError("UNKNOWN_GROUP_BY_PROPERTY", property);
3393
+ }
3394
+ if (!ALLOWED_TYPES.includes(schemaProperties[property])) {
3395
+ throw createError("INVALID_GROUP_BY_PROPERTY", property, ALLOWED_TYPES.join(", "), schemaProperties[property]);
3396
+ }
3397
+ }
3398
+ const allIDs = results.map(([id]) => getDocumentIdFromInternalId(orama.internalDocumentIDStore, id));
3399
+ const allDocs = await orama.documentsStore.getMultiple(orama.data.docs, allIDs);
3400
+ const allDocsLength = allDocs.length;
3401
+ const returnedCount = groupBy.maxResult || Number.MAX_SAFE_INTEGER;
3402
+ const listOfValues = [];
3403
+ const g = {};
3404
+ for (let i = 0; i < propertiesLength; i++) {
3405
+ const groupByKey = properties[i];
3406
+ const group = {
3407
+ property: groupByKey,
3408
+ perValue: {}
3409
+ };
3410
+ const values = /* @__PURE__ */ new Set();
3411
+ for (let j = 0; j < allDocsLength; j++) {
3412
+ const doc = allDocs[j];
3413
+ const value = await getNested(doc, groupByKey);
3414
+ if (typeof value === "undefined") {
3415
+ continue;
3416
+ }
3417
+ const keyValue = typeof value !== "boolean" ? value : "" + value;
3418
+ if (typeof group.perValue[keyValue] === "undefined") {
3419
+ group.perValue[keyValue] = {
3420
+ indexes: [],
3421
+ count: 0
3422
+ };
3423
+ }
3424
+ if (group.perValue[keyValue].count >= returnedCount) {
3425
+ continue;
3426
+ }
3427
+ group.perValue[keyValue].indexes.push(j);
3428
+ group.perValue[keyValue].count++;
3429
+ values.add(value);
3430
+ }
3431
+ listOfValues.push(Array.from(values));
3432
+ g[groupByKey] = group;
3433
+ }
3434
+ const combinations = calculateCombination(listOfValues);
3435
+ const combinationsLength = combinations.length;
3436
+ const groups = [];
3437
+ for (let i = 0; i < combinationsLength; i++) {
3438
+ const combination = combinations[i];
3439
+ const combinationLength = combination.length;
3440
+ const group = {
3441
+ values: [],
3442
+ indexes: []
3443
+ };
3444
+ const indexes = [];
3445
+ for (let j = 0; j < combinationLength; j++) {
3446
+ const value = combination[j];
3447
+ const property = properties[j];
3448
+ indexes.push(g[property].perValue[typeof value !== "boolean" ? value : "" + value].indexes);
3449
+ group.values.push(value);
3450
+ }
3451
+ group.indexes = intersect(indexes).sort((a, b) => a - b);
3452
+ if (group.indexes.length === 0) {
3453
+ continue;
3454
+ }
3455
+ groups.push(group);
3456
+ }
3457
+ const groupsLength = groups.length;
3458
+ const res = Array.from({
3459
+ length: groupsLength
3460
+ });
3461
+ for (let i = 0; i < groupsLength; i++) {
3462
+ const group = groups[i];
3463
+ const reduce = groupBy.reduce || DEFAULT_REDUCE;
3464
+ const docs = group.indexes.map((index) => {
3465
+ return {
3466
+ id: allIDs[index],
3467
+ score: results[index][1],
3468
+ document: allDocs[index]
3469
+ };
3470
+ });
3471
+ const func = reduce.reducer.bind(null, group.values);
3472
+ const initialValue = reduce.getInitialValue(group.indexes.length);
3473
+ const aggregationValue = docs.reduce(func, initialValue);
3474
+ res[i] = {
3475
+ values: group.values,
3476
+ result: aggregationValue
3477
+ };
3478
+ }
3479
+ return res;
3480
+ }
3481
+ function calculateCombination(arrs, index = 0) {
3482
+ if (index + 1 === arrs.length)
3483
+ return arrs[index].map((item) => [
3484
+ item
3485
+ ]);
3486
+ const head = arrs[index];
3487
+ const c2 = calculateCombination(arrs, index + 1);
3488
+ const combinations = [];
3489
+ for (const value of head) {
3490
+ for (const combination of c2) {
3491
+ combinations.push([
3492
+ value,
3493
+ ...combination
3494
+ ]);
3495
+ }
3496
+ }
3497
+ return combinations;
3498
+ }
3499
+
3500
+ // ../../node_modules/.pnpm/@orama+orama@1.2.1/node_modules/@orama/orama/dist/methods/search.js
5038
3501
  var defaultBM25Params = {
5039
3502
  k: 1.2,
5040
3503
  b: 0.75,
5041
3504
  d: 0.5
5042
3505
  };
5043
- async function createSearchContext(tokenizer, index, documentsStore, language, params, properties, tokens, docsCount) {
3506
+ async function createSearchContext(tokenizer, index, documentsStore, language, params, properties, tokens, docsCount, timeStart) {
5044
3507
  const indexMap = {};
5045
3508
  const docsIntersection = {};
5046
3509
  for (const prop of properties) {
@@ -5052,7 +3515,7 @@ async function createSearchContext(tokenizer, index, documentsStore, language, p
5052
3515
  docsIntersection[prop] = [];
5053
3516
  }
5054
3517
  return {
5055
- timeStart: await getNanosecondsTime(),
3518
+ timeStart,
5056
3519
  tokenizer,
5057
3520
  index,
5058
3521
  documentsStore,
@@ -5066,9 +3529,10 @@ async function createSearchContext(tokenizer, index, documentsStore, language, p
5066
3529
  }
5067
3530
  async function search2(orama, params, language) {
5068
3531
  var _a2, _b, _c;
3532
+ const timeStart = await getNanosecondsTime();
5069
3533
  params.relevance = Object.assign((_a2 = params.relevance) != null ? _a2 : {}, defaultBM25Params);
5070
3534
  const shouldCalculateFacets = params.facets && Object.keys(params.facets).length > 0;
5071
- const { limit = 10, offset = 0, term, properties, threshold = 1 } = params;
3535
+ const { limit = 10, offset = 0, term, properties, threshold = 1, distinctOn } = params;
5072
3536
  const isPreflight = params.preflight === true;
5073
3537
  const { index, docs } = orama.data;
5074
3538
  const tokens = await orama.tokenizer.tokenize(term != null ? term : "", language);
@@ -5076,7 +3540,7 @@ async function search2(orama, params, language) {
5076
3540
  if (!propertiesToSearch) {
5077
3541
  const propertiesToSearchWithTypes = await orama.index.getSearchablePropertiesWithTypes(index);
5078
3542
  propertiesToSearch = await orama.index.getSearchableProperties(index);
5079
- propertiesToSearch = propertiesToSearch.filter((prop) => propertiesToSearchWithTypes[prop] === "string");
3543
+ propertiesToSearch = propertiesToSearch.filter((prop) => propertiesToSearchWithTypes[prop].startsWith("string"));
5080
3544
  orama.caches["propertiesToSearch"] = propertiesToSearch;
5081
3545
  }
5082
3546
  if (properties && properties !== "*") {
@@ -5087,29 +3551,27 @@ async function search2(orama, params, language) {
5087
3551
  }
5088
3552
  propertiesToSearch = propertiesToSearch.filter((prop) => properties.includes(prop));
5089
3553
  }
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
- });
3554
+ const context = await createSearchContext(orama.tokenizer, orama.index, orama.documentsStore, language, params, propertiesToSearch, tokens, await orama.documentsStore.count(docs), timeStart);
5094
3555
  const hasFilters = Object.keys((_b = params.where) != null ? _b : {}).length > 0;
5095
3556
  let whereFiltersIDs = [];
5096
3557
  if (hasFilters) {
5097
3558
  whereFiltersIDs = await orama.index.searchByWhereClause(context, index, params.where);
5098
3559
  }
5099
- if (tokens.length) {
3560
+ const tokensLength = tokens.length;
3561
+ if (tokensLength) {
5100
3562
  const indexesLength = propertiesToSearch.length;
5101
3563
  for (let i = 0; i < indexesLength; i++) {
5102
3564
  var _params_boost;
5103
3565
  const prop = propertiesToSearch[i];
5104
- const tokensLength = tokens.length;
5105
- for (let j = 0; j < tokensLength; j++) {
3566
+ const tokensLength2 = tokens.length;
3567
+ for (let j = 0; j < tokensLength2; j++) {
5106
3568
  const term2 = tokens[j];
5107
3569
  const scoreList = await orama.index.search(context, index, prop, term2);
5108
3570
  context.indexMap[prop][term2].push(...scoreList);
5109
3571
  }
5110
3572
  const docIds = context.indexMap[prop];
5111
3573
  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);
3574
+ 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
3575
  const uniqueDocs = context.docsIntersection[prop];
5114
3576
  const uniqueDocsLength = uniqueDocs.length;
5115
3577
  for (let i2 = 0; i2 < uniqueDocsLength; i2++) {
@@ -5122,49 +3584,136 @@ async function search2(orama, params, language) {
5122
3584
  }
5123
3585
  }
5124
3586
  }
3587
+ } else if (tokens.length === 0 && term) {
3588
+ context.uniqueDocsIDs = {};
5125
3589
  } else {
5126
3590
  context.uniqueDocsIDs = Object.fromEntries(Object.keys(await orama.documentsStore.getAll(orama.data.docs)).map((k) => [
5127
3591
  k,
5128
3592
  0
5129
3593
  ]));
5130
3594
  }
5131
- let uniqueDocsArray = Object.entries(context.uniqueDocsIDs).sort(sortTokenScorePredicate);
3595
+ let uniqueDocsArray = Object.entries(context.uniqueDocsIDs).map(([id, score]) => [
3596
+ +id,
3597
+ score
3598
+ ]);
5132
3599
  if (hasFilters) {
5133
3600
  uniqueDocsArray = intersectFilteredIDs(whereFiltersIDs, uniqueDocsArray);
5134
3601
  }
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
- }
3602
+ if (params.sortBy) {
3603
+ if (typeof params.sortBy === "function") {
3604
+ const ids = uniqueDocsArray.map(([id]) => id);
3605
+ const docs2 = await orama.documentsStore.getMultiple(orama.data.docs, ids);
3606
+ const docsWithIdAndScore = docs2.map((d, i) => [
3607
+ uniqueDocsArray[i][0],
3608
+ uniqueDocsArray[i][1],
3609
+ d
3610
+ ]);
3611
+ docsWithIdAndScore.sort(params.sortBy);
3612
+ uniqueDocsArray = docsWithIdAndScore.map(([id, score]) => [
3613
+ id,
3614
+ score
3615
+ ]);
3616
+ } else {
3617
+ uniqueDocsArray = await orama.sorter.sortBy(orama.data.sorting, uniqueDocsArray, params.sortBy).then((results2) => results2.map(([id, score]) => [
3618
+ getInternalDocumentId(orama.internalDocumentIDStore, id),
3619
+ score
3620
+ ]));
5153
3621
  }
3622
+ } else {
3623
+ uniqueDocsArray = uniqueDocsArray.sort(sortTokenScorePredicate);
3624
+ }
3625
+ let results;
3626
+ if (!isPreflight && distinctOn) {
3627
+ results = await fetchDocumentsWithDistinct(orama, uniqueDocsArray, offset, limit, distinctOn);
3628
+ } else if (!isPreflight) {
3629
+ results = await fetchDocuments(orama, uniqueDocsArray, offset, limit);
5154
3630
  }
5155
3631
  const searchResult = {
5156
- elapsed: await orama.formatElapsedTime(await getNanosecondsTime() - context.timeStart),
3632
+ elapsed: {
3633
+ formatted: "",
3634
+ raw: 0
3635
+ },
5157
3636
  hits: [],
5158
3637
  count: uniqueDocsArray.length
5159
3638
  };
5160
- if (!isPreflight) {
3639
+ if (typeof results !== "undefined") {
5161
3640
  searchResult.hits = results.filter(Boolean);
5162
3641
  }
5163
3642
  if (shouldCalculateFacets) {
3643
+ const facets = await getFacets(orama, uniqueDocsArray, params.facets);
5164
3644
  searchResult.facets = facets;
5165
3645
  }
3646
+ if (params.groupBy) {
3647
+ searchResult.groups = await getGroups(orama, uniqueDocsArray, params.groupBy);
3648
+ }
3649
+ if (orama.afterSearch) {
3650
+ await runAfterSearch(orama.afterSearch, orama, params, language, searchResult);
3651
+ }
3652
+ searchResult.elapsed = await orama.formatElapsedTime(await getNanosecondsTime() - context.timeStart);
5166
3653
  return searchResult;
5167
3654
  }
3655
+ async function fetchDocumentsWithDistinct(orama, uniqueDocsArray, offset, limit, distinctOn) {
3656
+ const docs = orama.data.docs;
3657
+ const values = /* @__PURE__ */ new Map();
3658
+ const results = [];
3659
+ const resultIDs = /* @__PURE__ */ new Set();
3660
+ const uniqueDocsArrayLength = uniqueDocsArray.length;
3661
+ let count2 = 0;
3662
+ for (let i = 0; i < uniqueDocsArrayLength; i++) {
3663
+ const idAndScore = uniqueDocsArray[i];
3664
+ if (typeof idAndScore === "undefined") {
3665
+ continue;
3666
+ }
3667
+ const [id, score] = idAndScore;
3668
+ if (resultIDs.has(id)) {
3669
+ continue;
3670
+ }
3671
+ const doc = await orama.documentsStore.get(docs, id);
3672
+ const value = await getNested(doc, distinctOn);
3673
+ if (typeof value === "undefined" || values.has(value)) {
3674
+ continue;
3675
+ }
3676
+ values.set(value, true);
3677
+ count2++;
3678
+ if (count2 <= offset) {
3679
+ continue;
3680
+ }
3681
+ results.push({
3682
+ id: getDocumentIdFromInternalId(orama.internalDocumentIDStore, id),
3683
+ score,
3684
+ document: doc
3685
+ });
3686
+ resultIDs.add(id);
3687
+ if (count2 >= offset + limit) {
3688
+ break;
3689
+ }
3690
+ }
3691
+ return results;
3692
+ }
3693
+ async function fetchDocuments(orama, uniqueDocsArray, offset, limit) {
3694
+ const docs = orama.data.docs;
3695
+ const results = Array.from({
3696
+ length: limit
3697
+ });
3698
+ const resultIDs = /* @__PURE__ */ new Set();
3699
+ for (let i = offset; i < limit + offset; i++) {
3700
+ const idAndScore = uniqueDocsArray[i];
3701
+ if (typeof idAndScore === "undefined") {
3702
+ break;
3703
+ }
3704
+ const [id, score] = idAndScore;
3705
+ if (!resultIDs.has(id)) {
3706
+ const fullDoc = await orama.documentsStore.get(docs, id);
3707
+ results[i] = {
3708
+ id: getDocumentIdFromInternalId(orama.internalDocumentIDStore, id),
3709
+ score,
3710
+ document: fullDoc
3711
+ };
3712
+ resultIDs.add(id);
3713
+ }
3714
+ }
3715
+ return results;
3716
+ }
5168
3717
 
5169
3718
  // src/indexer.ts
5170
3719
  var import_debug = __toESM(require_src());
@@ -5172,6 +3721,7 @@ var debug = (0, import_debug.default)("verdaccio:search:indexer");
5172
3721
  var SearchMemoryIndexer = class {
5173
3722
  database;
5174
3723
  storage;
3724
+ logger;
5175
3725
  configureStorage(storage) {
5176
3726
  this.storage = storage;
5177
3727
  }
@@ -5179,36 +3729,45 @@ var SearchMemoryIndexer = class {
5179
3729
  if (this.database) {
5180
3730
  debug("searching %s at indexer", term);
5181
3731
  const searchResult = await search2(this.database, {
5182
- term,
5183
- properties: "*"
3732
+ term
5184
3733
  });
5185
3734
  return searchResult;
5186
3735
  }
5187
3736
  }
3737
+ prepareKeywords(keywords) {
3738
+ if (typeof keywords === "undefined") {
3739
+ return "";
3740
+ } else if (typeof keywords === "string") {
3741
+ return keywords;
3742
+ }
3743
+ return keywords.join(",");
3744
+ }
5188
3745
  async add(pkg) {
5189
3746
  if (this.database) {
5190
3747
  const name = pkg.name;
5191
3748
  debug("adding item %s to the indexer", name);
5192
- insert4(this.database, {
3749
+ const item = {
5193
3750
  id: name,
5194
3751
  name,
5195
3752
  description: pkg.description,
5196
- version: `v${pkg.version}`,
5197
- keywords: pkg.keywords,
5198
- author: pkg._npmUser ? pkg._npmUser.name : "???"
5199
- });
3753
+ version: pkg.version,
3754
+ keywords: this.prepareKeywords(pkg.keywords),
3755
+ author: pkg._npmUser ? pkg._npmUser.name : ""
3756
+ };
3757
+ await insert5(this.database, item);
5200
3758
  }
5201
3759
  }
5202
3760
  async remove(name) {
5203
3761
  if (this.database) {
5204
3762
  debug("removing item %s to the indexer", name);
5205
- await remove4(this.database, name);
3763
+ await remove5(this.database, name);
5206
3764
  }
5207
3765
  }
5208
- reindex() {
3766
+ async reindex() {
5209
3767
  var _a2;
5210
3768
  debug("reindexing search indexer");
5211
- (_a2 = this.storage) == null ? void 0 : _a2.getLocalDatabase((error, packages) => {
3769
+ (_a2 = this.storage) == null ? void 0 : _a2.getLocalDatabase(async (error, packages) => {
3770
+ var _a3;
5212
3771
  if (error) {
5213
3772
  throw error;
5214
3773
  }
@@ -5219,13 +3778,18 @@ var SearchMemoryIndexer = class {
5219
3778
  while (i--) {
5220
3779
  const pkg = packages[i];
5221
3780
  debug("indexing package %s", pkg == null ? void 0 : pkg.name);
5222
- this.add(pkg);
3781
+ try {
3782
+ await this.add(pkg);
3783
+ } catch (err) {
3784
+ (_a3 = this.logger) == null ? void 0 : _a3.error({ err: err.message }, "error @{err} indexing package");
3785
+ }
5223
3786
  }
5224
3787
  debug("reindexed search indexer");
5225
3788
  });
5226
3789
  }
5227
- async init() {
5228
- this.database = await create5({
3790
+ async init(logger) {
3791
+ this.logger = logger;
3792
+ this.database = await create6({
5229
3793
  schema: {
5230
3794
  id: "string",
5231
3795
  name: "string",