@eeplatform/core 1.8.2 → 1.8.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @eeplatform/core
2
2
 
3
+ ## 1.8.4
4
+
5
+ ### Patch Changes
6
+
7
+ - dd69528: Update PSGC query
8
+
9
+ ## 1.8.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 8d80c53: Add logger to PSGC get all function
14
+
3
15
  ## 1.8.2
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -7216,8 +7216,17 @@ function usePSGCRepo() {
7216
7216
  }
7217
7217
  }
7218
7218
  async function getByName({ name, prefix = "", type = "" } = {}) {
7219
- const query = { $text: { $search: name }, type };
7220
- const cacheKeyOptions = { name, type };
7219
+ const stopWords = /* @__PURE__ */ new Set(["of", "the"]);
7220
+ const words = name.trim().split(/\s+/).filter((w) => w.length > 2 && !stopWords.has(w.toLowerCase())).map((w) => w.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
7221
+ const regex = words.map((w) => `(?=.*${w})`).join("");
7222
+ const query = {
7223
+ name: { $regex: regex, $options: "i" }
7224
+ };
7225
+ const cacheKeyOptions = { type };
7226
+ if (type) {
7227
+ query.type = type;
7228
+ cacheKeyOptions.type = type;
7229
+ }
7221
7230
  const _types = ["City", "Mun"];
7222
7231
  if (_types.includes(type)) {
7223
7232
  query.type = { $in: _types };
@@ -7227,6 +7236,10 @@ function usePSGCRepo() {
7227
7236
  cacheKeyOptions.prefix = prefix;
7228
7237
  }
7229
7238
  const cacheKey = (0, import_nodejs_utils39.makeCacheKey)(namespace_collection, { name });
7239
+ import_nodejs_utils39.logger.log({
7240
+ level: "info",
7241
+ message: `Query for getByName PSGC: ${JSON.stringify(query)}`
7242
+ });
7230
7243
  try {
7231
7244
  const cached = await getCache(cacheKey);
7232
7245
  if (cached) {